Guest User

Untitled

a guest
May 3rd, 2017
215
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.  
  19. delay(30);
  20. while(esp8266.available()) {
  21. String data = esp8266.readStringUntil('\n');
  22. Serial.println("Got response from esp8266: " + data);
  23. }
  24. }
Add Comment
Please, Sign In to add comment