Hi, there
I have bought this board.
I have success with understanding of DIP switches. But, I am failing to integrate Blynk with this board:
Using this board with Android Blynk app running on Android 9 & 6
I am not able to upload soil moisture sensor data to value display widget or gauge.
I have checked the ESP8266 Serial
It connects to blynk and shows ready for ping.
The problem with this board is I can’t use serial while ESP8266 and Atmega2560 are communicating according to DIP Switches.
Is there any mistake in code or firmware or what? Please guide.
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
char auth[] = "tDUJKWT72VJclvEwIk0nTNXX0k_x0sW6";
char ssid[] = "CA Parul Gupta";
char pass[] = "9a346f62b700";
int sensorValue = 0;
int sensorPin = A0;
int sensorValuePercent = 0;
#define EspSerial Serial1
// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
sensorValue = map(sensorValue, 0, 1023, 1023, 0);
sensorValuePercent = (sensorValue / 1023) * 100;
sensorValue = analogRead(sensorPin);
EspSerial.print("\nThe moisture level is");
EspSerial.print(sensorValue);
EspSerial.print("\n");
EspSerial.print(sensorValuePercent);
delay(1000);
Blynk.virtualWrite(V5, sensorValue);
}
void setup()
{
// Debug console
Serial.begin(9600);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
myTimerEvent();
}