This program is a simple ESPNow "hello World!" for the ESP8266.
It based on two on ESP8266 – Witty Cloud Moduls and ESP-Now for the connection of both.
Estimated time: ~ 20 minutes
-
Download the Arduino IDE and install it. (Install Guide)
-
Add the needed libraries. (
ESPNow-HelloWorld/Installation/..
)- ESP8266 (How to add libraries)
- Color (How to add .zip - libraries) (The library is in the installation directory)
-
Connect the ESP8266 that will be the server host to your PC.
- Make sure your tool settings are correct (Port could be different)
-
Open the GetServerMac program in the IDE
-
Upload the program to the ESP. (
Ctrl + U
) -
Open the serial monitor. (
Ctrl + Shift + M
orTools -> Serial Monitor
) -
Copy the AP MAC and the STA MAC from the console to the Server-Mac.txt file.
(There should be enough time, but if you have not received a printout on the monitor, press the reset button on the ESP)Console Output Example: =========================================================== Gameserver ----------------------------------------------------------- This node AP mac: AF:FA:BC:02:E6:CD This node STA mac: AC:FA:BC:02:E6:CD ===========================================================
-
Open the ESPNow-HelloWorld program with the Arduino IDE.
-
Change the server Mac addresses for the targets in the code (don't just copy the entire mac.txt file)
41 // server esp mac addresses for the targets
42 #ifdef TARGET
43
44 uint8_t GAMESERVER_ap_mac[] = {0xEE, 0xFA, 0xBC, 0x0C, 0xE6, 0xAF};
45 uint8_t GAMESERVER_sta_mac[] = {0xEC, 0xFA, 0xBC, 0x0C, 0xE6, 0xAF};
46
47 // init sensor val
48 int initVal;
49
50 #endif
- Comment out the target mode as follows:
25 // unwanted modes should be commented out
26 #define DEBUG
27 //#define TARGET
28 #define SERVER
-
Upload the code to the server ESP. (
Ctrl + U
) -
Connect the ESP8266 that will be the targets.
-
Comment out the server mode as follows:
25 // unwanted modes should be commented out
26 #define DEBUG
27 #define TARGET
28 //#define SERVER
-
Upload the program to the ESP. (
Ctrl + U
) -
Software installation completed.