O'Reilly logo

Learn Arduino Prototyping in 10 days by Kallol Bosu Roy Choudhuri

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required