From 06aa5d0b73c8cbaed5ddbba3c8ee5476b143c86e Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 20 Jul 2020 16:47:05 -0400 Subject: [PATCH] Add files via upload Test program to verify an ESP8266 connected to an Uno is sending and receiving commands --- docs/UnoWifiTest.ino | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/UnoWifiTest.ino diff --git a/docs/UnoWifiTest.ino b/docs/UnoWifiTest.ino new file mode 100644 index 0000000..7cdeece --- /dev/null +++ b/docs/UnoWifiTest.ino @@ -0,0 +1,38 @@ +// Basic serial communication with ESP8266 +// Uses serial monitor for communication with ESP8266 +// +// Pins +// Arduino pin 2 (RX) to ESP8266 TX +// Arduino pin 3 (TX) to ESP8266 RX +// Connect GND from the Arduino UNO to GND on the ESP8266 +// Pull ESP8266 CH_PD (Also called EN) HIGH (3.3V) +// +// When a command is entered in to the serial monitor on the computer +// the Arduino will relay it to the ESP8266 +// + +#include +SoftwareSerial ESPserial(2, 3); // RX | TX Put your preferred pins here + +void setup() +{ + Serial.begin(9600); // communication with the host computer + //while (!Serial) { ; } + + // Start the software serial for communication with the ESP8266 + ESPserial.begin(9600); + + Serial.println(""); + Serial.println("Remember to to set Both NL & CR in the serial monitor."); + Serial.println("Ready"); + Serial.println(""); +} + +void loop() +{ + // listen for communication from the ESP8266 and then write it to the serial monitor + if ( ESPserial.available() ) { Serial.write( ESPserial.read() ); } + + // listen for user input and send it to the ESP8266 + if ( Serial.available() ) { ESPserial.write( Serial.read() ); } +}