I am trying to read data from a Blynk widget via ESP8266 and Arduino UNO and trying to send it to another slave Arduino UNO. But, the problem is the data is taking some time to reach to the slave Arduino for further processing and I need it to be fast as it is needed for controlling a drone.
If any one can help, please help. I am a tenth grader and a newbie. So, I don't have a lot of experience.
Here is the code for the master Arduino:
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <SoftwareSerial.h> //We are using software serial so as not to conflict with serial download and monitor
SoftwareSerial mySerial(5,6); // RX, TX
int of=0;
int throttle=0;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "auth";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "wifi_name";
char pass[] = "wifi_pass";
// Hardware Serial on Mega, Leonardo, Micro...
//#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(&Serial);
WidgetLED l(V3);
void setup()
{
// Debug console
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
Serial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
mySerial.begin(9600);
}
void loop()
{
Blynk.run();
l.on();
mySerial.write(of);
mySerial.write(throttle);
}
BLYNK_WRITE(V1)
{
of = 100+param.asInt();
}
BLYNK_WRITE(V2)
{
throttle = param.asInt();
}