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?
// 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
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.
@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 )
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.
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.
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