Hi.
Doing my first Blynk project. I have some questions - simple one for now. So I need so my esp-12f, as shell, for Uno board - light up LEDs on 4, 5 pins by Blynk app, as V0 and V1 pins. Here is sketch, but I getting error.
Sketch:
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";
// 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);
void setup()
{
// Debug console
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
BLYNK_WRITE(V0) {
if (param.asInt() == 1) {
digitalWrite(4, HIGH);
} else {
digitalWrite(4, LOW);
}
}
BLYNK_WRITE(V1) {
if (param.asInt() == 1) {
digitalWrite(5, HIGH);
} else {
digitalWrite(5, LOW);
}
}
Blynk.begin(auth, wifi, ssid, pass);
}
void loop()
{
Blynk.run();
}
Error:
Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Users\xxx\AppData\Local\Temp\arduino_modified_sketch_930730\ESP8266_Shield.ino: In function 'void setup()':
ESP8266_Shield:72: error: a function-definition is not allowed here before '{' token
BLYNK_WRITE(V0) {
^
ESP8266_Shield:93: error: expected '}' at end of input
}
^
exit status 1
a function-definition is not allowed here before '{' token
As I understand problem with { } but can’t see anywhere mistake. Or maybe something else? I done same as in Gunner robot project (with Blynk_write(V0)). Here link to his project:
Nothing else in loop - I got this.
But maybe I’m learning or can’t understand you enought. Have your checked gunners sketch? There link in first post. They placed same in sketch, I think. Maybe your can explain me in example? Thanks for patience
Paste your formatted sketch.
Maybe you are pushing the baud rate too high. You have to crawl at 9600 with shields rather than 115200 for real ESP8266 connections.
Flashed that firmware. Now I getting from Arduino serial - “failed to disable echo”. Esp8266 in serial giving me: “ai thinker. Ready”. Guess problem is in Blynk? I found some topic with same problem, but it a bit old though… [SOLVED] “Failed to disable echo” PROBLEM
Speaking of OLD… sounds like your library is also OLD… Your screenshot shows v0.4.8 but that version got rid of the “Cannot disable echo” for a more understandable “ESP is not responding”.
So it sounds like you may have some corruption in your Blynk libraries?? Perhaps remove all of them and reinstall from the source.
Working now all fine. Was some problem with flasher software. I change it, now it’s all fine. At 9600 working without timeout. Just at the moment don’t have much time. Will continue threat later.