Advertisement
martinius96

Untitled

Dec 23rd, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. String inputString = "Hello"; // a string to hold incoming data
  4. boolean stringComplete = false; // whether the string is complete
  5.  
  6. #define DEBUG true // turn debug message on or off in serial
  7.  
  8. SoftwareSerial mySerial(0, 1); // RX, TX
  9. //SoftwareSerial mySerial(11, 10); // RX, TX
  10.  
  11. void setup()
  12. {
  13. Serial.begin(9600);
  14. // Serial.begin(115200);
  15. // set the data rate for the SoftwareSerial port
  16. mySerial.begin(115200);
  17. Serial.println("Hello, world?");
  18. mySerial.println("AT+RST");
  19. }
  20.  
  21. void loop()
  22. {
  23. Serial.println("Sending an AT command...");
  24. mySerial.println("AT");
  25. delay(1000);
  26. while (mySerial.available()){ //Response OK if received on ESP8266 side
  27. String inData = mySerial.readStringUntil('\n');
  28. Serial.println("Got reponse from ESP8266: " + inData);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement