first commit
This commit is contained in:
28
TEST_SERIAL_UNO/TEST_SERIAL_UNO.ino
Normal file
28
TEST_SERIAL_UNO/TEST_SERIAL_UNO.ino
Normal file
@@ -0,0 +1,28 @@
|
||||
// Pins
|
||||
// Arduino pin 2 (RX) to ESP8266 TX
|
||||
// Arduino pin 3 to voltage divider then to ESP8266 RX
|
||||
// Connect GND from the Arduiono to GND on the ESP8266
|
||||
// Pull ESP8266 CH_PD HIGH
|
||||
#include <SoftwareSerial.h>
|
||||
SoftwareSerial ESPserial(3, 2); // RX | TX
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600); // communication with the host computer
|
||||
// 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
|
||||
while ( ESPserial.available() ) { Serial.write( ESPserial.read() ); }
|
||||
// listen for user input and send it to the ESP8266
|
||||
while( Serial.available() ) { ESPserial.write( Serial.read() ); }
|
||||
|
||||
String json = "/json.htm?type=command¶m=udevice&idx=892&nvalue=0&svalue=0;0;0;0;510;0";
|
||||
ESPserial.print(json);
|
||||
delay(10000);
|
||||
}
|
||||
Reference in New Issue
Block a user