Edge device sketch

Once you have built the edge device circuit as explained in the previous section, go ahead and load the following sketch for ESP8266 into the Arduino Uno board:

 #include <SoftwareSerial.h> //Usage: object-name (RX-pin, TX-pin) SoftwareSerial ESP8266 (6, 7); void setup() { // Configure the hardware and software Serial Serial.begin(9600); ESP8266.begin(9600); } // main program logic to run repeatedly void loop() { // keep checking for user input from the Serial Monitor window char cmd = Serial.read(); if (cmd == '1') { AT(); } if (cmd == '2') { connectWifi(); } if (cmd == '3') { CIPSTART(); } if (cmd == '4') { CIPSEND(); } if (cmd == '5') { sendRequest(); } if (cmd == '6') { disconnectWifi(); } } // logic to check whether ...

Get Learn Arduino Prototyping in 10 days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.