IP Configuration
This commit is contained in:
48
lib/WiFiEsp/test/EspDebug/EspDebug.ino
Normal file
48
lib/WiFiEsp/test/EspDebug/EspDebug.ino
Normal file
@@ -0,0 +1,48 @@
|
||||
// EspDebug - Test sketch for ESP8266 module
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
// Emulate Serial1 on pins 7/6 if not present
|
||||
#ifndef HAVE_HWSERIAL1
|
||||
#include "SoftwareSerial.h"
|
||||
SoftwareSerial Serial1(6, 7); // RX, TX
|
||||
#endif
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200); // serial port used for debugging
|
||||
Serial1.begin(9600); // your ESP's baud rate might be different
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if(Serial1.available()) // check if the ESP is sending a message
|
||||
{
|
||||
while(Serial1.available())
|
||||
{
|
||||
int c = Serial1.read(); // read the next character
|
||||
Serial.write((char)c); // writes data to the serial monitor
|
||||
}
|
||||
}
|
||||
|
||||
if(Serial.available())
|
||||
{
|
||||
// wait to let all the input command in the serial buffer
|
||||
delay(10);
|
||||
|
||||
// read the input command in a string
|
||||
String cmd = "";
|
||||
while(Serial.available())
|
||||
{
|
||||
cmd += (char)Serial.read();
|
||||
}
|
||||
|
||||
// print the command and send it to the ESP
|
||||
Serial.println();
|
||||
Serial.print(">>>> ");
|
||||
Serial.println(cmd);
|
||||
|
||||
// send the read character to the ESP
|
||||
Serial1.print(cmd);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user