Guest User

Untitled

a guest
Apr 29th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
  4. const byte txPin = 3; // Wire this to Rx Pin of ESP8266
  5.  
  6. // We'll use a software serial interface to connect to ESP8266
  7. SoftwareSerial esp8266(rxPin,txPin);
  8.  
  9. void setup() {
  10. Serial.begin(9600);
  11. esp8266.begin(9600);
  12. delay(1000);
  13. }
  14.  
  15. void loop() {
  16. Serial.println("Sending an AT commands");
  17. esp8266.println("AT");
  18. delay(30);
  19. while(esp8266.available()) {
  20. String data = esp8266.readStringUntil('\n');
  21. Serial.println("Got response from esp8266: " + data);
  22. }
  23. }
Add Comment
Please, Sign In to add comment