Failed at step 3 (Sketch Builder issue)

I was following the instructions at http://help.blynk.cc/getting-started-library-auth-token-code-examples/getting-started

and I went to the example builder at https://examples.blynk.cc/?board=Arduino%20Uno&shield=ESP8266%20WiFi%20Shield&example=GettingStarted%2FBlynkBlink

I set it for an Arduino UNO with an ESP8266 wifi shield. Copied the code into the Arduino environment and tried to compile it. The result was:

Arduino: 1.8.1 (Linux), Board: "Arduino/Genuino Uno"

sketch_may25a:54: error: 'Serial1' was not declared in this scope
 #define EspSerial Serial1
                   ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino:63:15: note: in expansion of macro 'EspSerial'
 ESP8266 wifi(&EspSerial);
               ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino: In function 'void setup()':
sketch_may25a:54: error: 'Serial1' was not declared in this scope
 #define EspSerial Serial1
                   ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino:71:3: note: in expansion of macro 'EspSerial'
   EspSerial.begin(ESP8266_BAUD);
   ^
Multiple libraries were found for "ESP8266_Lib.h"
 Used: /home/chris/Arduino/libraries/BlynkESP8266_Lib
 Not used: /home/chris/Arduino/libraries/BlynkESP8266-master
exit status 1
'Serial1' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Any hints on what I did wrong? Where should Serial1 be declared?

Back again. Forgot to mention that I tried the other BlynkESP8266_Lib and the result was:

Arduino: 1.8.1 (Linux), Board: "Arduino/Genuino Uno"

sketch_may25a:54: error: 'Serial1' was not declared in this scope
 #define EspSerial Serial1
                   ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino:63:15: note: in expansion of macro 'EspSerial'
 ESP8266 wifi(&EspSerial);
               ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino: In function 'void setup()':
sketch_may25a:54: error: 'Serial1' was not declared in this scope
 #define EspSerial Serial1
                   ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino:71:3: note: in expansion of macro 'EspSerial'
   EspSerial.begin(ESP8266_BAUD);
   ^
exit status 1
'Serial1' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Looks like I still don't have Serial1 defined.

The verbose response is: 

Arduino: 1.8.1 (Linux), Board: "Arduino/Genuino Uno"

/home/chris/arduino-1.8.1/arduino-builder -dump-prefs -logger=machine -hardware /home/chris/arduino-1.8.1/hardware -hardware /home/chris/.arduino15/packages -tools /home/chris/arduino-1.8.1/tools-builder -tools /home/chris/arduino-1.8.1/hardware/tools/avr -tools /home/chris/.arduino15/packages -built-in-libraries /home/chris/arduino-1.8.1/libraries -libraries /home/chris/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path /tmp/arduino_build_784752 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/home/chris/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.arduinoOTA.path=/home/chris/.arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -prefs=runtime.tools.avr-gcc.path=/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -verbose /home/chris/Arduino/sketch_may25a/sketch_may25a.ino
/home/chris/arduino-1.8.1/arduino-builder -compile -logger=machine -hardware /home/chris/arduino-1.8.1/hardware -hardware /home/chris/.arduino15/packages -tools /home/chris/arduino-1.8.1/tools-builder -tools /home/chris/arduino-1.8.1/hardware/tools/avr -tools /home/chris/.arduino15/packages -built-in-libraries /home/chris/arduino-1.8.1/libraries -libraries /home/chris/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path /tmp/arduino_build_784752 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/home/chris/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.arduinoOTA.path=/home/chris/.arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -prefs=runtime.tools.avr-gcc.path=/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -verbose /home/chris/Arduino/sketch_may25a/sketch_may25a.ino
Using board 'uno' from platform in folder: /home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21
Using core 'arduino' from platform in folder: /home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21
Detecting libraries used...
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "/tmp/arduino_build_784752/sketch/sketch_may25a.ino.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "/tmp/arduino_build_784752/sketch/sketch_may25a.ino.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/tmp/arduino_build_784752/sketch/sketch_may25a.ino.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/home/chris/Arduino/libraries/BlynkESP8266-master/ESP8266.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/home/chris/Arduino/libraries/Blynk/src/utility/BlynkDebug.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/home/chris/Arduino/libraries/Blynk/src/utility/BlynkHandlers.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/home/chris/Arduino/libraries/Blynk/src/utility/BlynkTimer.cpp" -o "/dev/null"
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/home/chris/Arduino/libraries/Blynk/src/utility/utility.cpp" -o "/dev/null"
Generating function prototypes...
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/tmp/arduino_build_784752/sketch/sketch_may25a.ino.cpp" -o "/tmp/arduino_build_784752/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/chris/arduino-1.8.1/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_784752/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/home/chris/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/cores/arduino" "-I/home/chris/.arduino15/packages/arduino/hardware/avr/1.6.21/variants/standard" "-I/home/chris/Arduino/libraries/BlynkESP8266-master" "-I/home/chris/Arduino/libraries/Blynk/src" "/tmp/arduino_build_784752/sketch/sketch_may25a.ino.cpp" -o "/tmp/arduino_build_784752/sketch/sketch_may25a.ino.cpp.o"
sketch_may25a:54: error: 'Serial1' was not declared in this scope
 #define EspSerial Serial1
                   ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino:63:15: note: in expansion of macro 'EspSerial'
 ESP8266 wifi(&EspSerial);
               ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino: In function 'void setup()':
sketch_may25a:54: error: 'Serial1' was not declared in this scope
 #define EspSerial Serial1
                   ^
/home/chris/Arduino/sketch_may25a/sketch_may25a.ino:71:3: note: in expansion of macro 'EspSerial'
   EspSerial.begin(ESP8266_BAUD);
   ^
Using library BlynkESP8266-master in folder: /home/chris/Arduino/libraries/BlynkESP8266-master (legacy)
Using library Blynk at version 0.5.2 in folder: /home/chris/Arduino/libraries/Blynk 
exit status 1
'Serial1' was not declared in this scope

Don’t understand it much but, hopefully someone out there can help… please.

Arduino UNO has only 1 Serial port, so you have to use SoftwareSerial or forgo Debugging via the Serial port.

Why does the example put it in then?

How do I use SoftwareSerial?

Because it says so in the code:

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

Uncomment and comment the right ones… attach the correct ports and feed the ESP power from an external source, the UNO doesn’t have enough power.

Besides that, good luck getting this stable, it’s a pain in the a$$. You are better off getting a Wemos D1 mini or ESP32 to program directly without resorting to slow UNO’s and the likes.

Hey, it’s not that bad already! At least me and @Gunner are using it with success. Parhaps the pain in the a$$ is the software serial port- I never had much success with that for a long term running devices.

Well, for beginners it can be fatal if you are not stubborn like us :slight_smile:
That’s why I’m suggesting a different path, but SoftwareSerial is really unstable. You should use hardware serial in any case, but with an UNO, well … you’d have to setup Software Serial for debugging. It can be done, but it’s just complex and useless when you can buy a Wemos D1 for around 7 bucks.

So… the code isn’t generated for a UNO at all. Why have a box where you select UNO? It only gives a false sense that the code will work.

I’m not gonna enter this discussion, either take our advice and hints or don’t, it’s up to you. No offense :slight_smile:

Happy to help out most of the time, but it requires effort from two sides, not just me.

1 Like

Compiled this time. I’ll try and work out the circuit and see what happens

Ok, you right (although I have not checked it personally) but is it so hard to read few lines of code where it is clearly stated?

@TheCook There are too many variants of hardware combos, some effort is expected on the end user to read the instructions and have some basic Arduino knowledge… this isn’t Lego (although they have instructions that need to be followed as well, if you want to make what you see on the box :stuck_out_tongue: )

Change this

// 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

To this

// 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 9600

Then make sure you are wiring the ESP properly to pins 2 & 3 (RZ on one device goes to TX on the other and visa versa) and have set it for BAUD 9600 via AT commands… Google if unsure how that is done… many tutorials are out there.

Also power your ESP with seperate 3.3v PSU (just share the GND with the Arduino) as the Arduino’s 3.3v regulator is not powerful enough.

Search this forum for keywords like Arduino, UNO, ESP, ESP-01, Shield, etc. as there are many full topics with all these and more issues and answers, already answered many times over.

Blynk - RE-SEAR-CH

I’m not expecting Lego. BUT I did expect a site that lets you select your devices and then has a button to cut and paste into the arduino environment to sort of give you code that should work for the combination you selected and pasted without needing to change it. I did read all the stuff at the front… just not all the code below. I think I made the mistake that there was some ā€˜smarts’ behind the code generator.

Never mind. Like I said it compiled and I will try and work out the appropriate circuit to make it work.

I have messed with the AT stuff. It must be 30 years since I messed with that last time. All those memories… fading to black. Working on a recalcitrant Raspberry Pi Kodi box for now. Will get back to arduino sooner or later.

Love the Research think. It is handy to know which words are key. I’d like to think that I can continue to learn the keys.

Taa

We didn’t even have this around a year ago… these things take a lot of time and effort on the developers part… and as I stated, there is way too many possible combinations.

I hear ya on that… ā€œeverything old will become new again.ā€ā€¦ apparently including the dreaded AT commands :stuck_out_tongue:

Thanks… my own design, based on my own experiences…

I suppose that should have been thinG

It all worked fine. On to the next question.