Hi I've edited my code, I've solved the problem, how do I combine the code with the code I'm going to give me?
The project I'm doing is also different from the wireless network names of everyone so they connect to the esp8266 module. I want to connect by doing network scan, I want the system to work normally after the connection, my code below is one of my project, the other is wifi manager how can I combine two codes? I'm getting error in assembly
this my project
#include <ESP8266WiFi.h>
#define BLYNK_PRINT Serial //
#include <BlynkSimpleEsp8266.h> // NETTEN HABERLEŞME YAZILIM KUTUPHANESİ
char auth[] = "3f49515ca84c4e2ddd8b0f3f58d354907aa"; // TOKEN KODUM
/* KABLOSUZ AĞ BAĞLANMA KODLARIM */
char ssid[] = "okhan";
char pass[] = "atakan2009";
/* YAHYA KILIÇASLAN BOTECH ALARM SİSTEMİ*/
/* 01.05.2018*/
/* KULLANILACAK PIN UÇLARIM */
#define pirLedPin D7 // PIR LED YAKMAK İÇİN 7 NOLU DİJİTAL PİNİM
#define suLedPin D8 // SU LED YAKMAK İÇİN 7 NOLU DİJİTAL PİNİM
#define pirPin D2 // HAREKET SENSÖRÜ
#define suPin D3 // SU BASKINI SENSORU
#define gazPin D4 // GAZ DEDEKTÖRÜ
#define dumanPin D5 // DUMAN DEDKTÖRÜ
int pirValue; // PIR DEĞERİ
int suValue; // SU BASKINI DEGERI
int gazValue; // GAZ DEĞERİNİ OKU
int dumanValue; // SU DEĞERİNİ OKU
/* PİN DURUMLARINI BELİRLE GİRİŞ/ÇIKIŞ */
void setup()
{
Serial.begin(115200);
delay(1000);
Blynk.begin(auth, ssid, pass);
pinMode(pirLedPin, OUTPUT);
pinMode(suLedPin, OUTPUT);
pinMode(pirPin, INPUT);
pinMode(suPin, INPUT);
pinMode(gazPin, INPUT);
pinMode(dumanPin, INPUT);
digitalWrite(suLedPin, LOW);
digitalWrite(pirLedPin, LOW);
}
/* PİN DURUMLARINI BELİRLE GİRİŞ/ÇIKIŞ KODLARIN BİTİŞİ */
/****************************************************** */
/* OKUNAN DEĞERLERİ MESAJ İLE YOLLA LED YAK VS */
void loop()
{
getValues();
Blynk.run();
}
void getValues(void)
{
pirValue = digitalRead(pirPin);
suValue = digitalRead(suPin);
gazValue = digitalRead(gazPin);
dumanValue = digitalRead(dumanPin);
if (pirValue)
{
Serial.println("HAREKET ALGILANDI");
Blynk.notify("EVDE HIRSIZ VAR!");
}
if (suValue)
{
Serial.println("ZEMINDE SU ALGILANDI");
Blynk.notify("EVDE SU BASKINI VAR!");
}
if (gazValue)
{
Serial.println("GAZ SIZINTISI");
Blynk.notify("DOĞALGAZ SIZINTISI VAR!");
}
if (dumanValue)
{
Serial.println("DUMAN ALGILANDI");
Blynk.notify("YANGIN VAR!");
}
digitalWrite(pirLedPin, pirValue);
digitalWrite(suLedPin, suValue);
digitalWrite(pirLedPin, gazValue);
digitalWrite(pirLedPin, dumanValue);
}
Wifi Manager Code
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
// set pin numbers:
#define D0 16 // USER LED Wake
#define wifipin D0 // the number of the LED pin
#define D1 5
#define ConfigWiFi_Pin D1
#define ESP_AP_NAME "BotechAlarm"
void setup()
{
// initialize pin D0 as an output.
pinMode(wifipin, OUTPUT);
pinMode(ConfigWiFi_Pin,INPUT_PULLUP);
Serial.begin(115200);
digitalWrite(wifipin,LOW);//Turn on the LED
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
if(digitalRead(ConfigWiFi_Pin) == LOW) // Press button
{
//reset saved settings
wifiManager.resetSettings(); // go to ip 192.168.4.1 to config
}
//fetches ssid and password from EEPROM and tries to connect
//if it does not connect, it starts an access point with the specified name
//and goes into a blocking loop awaiting configuration
wifiManager.autoConnect(ESP_AP_NAME);
while (WiFi.status() != WL_CONNECTED)
{
delay(250);
Serial.print(".");
}
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
digitalWrite(wifipin,HIGH);
}
void loop()
{
digitalWrite(D0, HIGH); // turn off the LED
delay(2000); // wait for two seconds
digitalWrite(D0, LOW); // turn on the LED
delay(2000); // wait for two seconds
}
I need to combine these two codes for my project, I failed! Could you help!