Guest User

Untitled

a guest
May 3rd, 2017
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 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+RST");
  18. esp8266.println("AT+CWMODE=1");
  19. esp8266.println("ATE0");
  20. esp8266.println("AT+CWLAP");
  21. esp8266.println("AT+CWJAP_DEF=\"moto\",\"reset1234\"");
  22.  
  23. delay(30);
  24. while(esp8266.available()) {
  25. String data = esp8266.readStringUntil('\n');
  26. Serial.println("Got response from esp8266: " + data);
  27. }
  28. }
Add Comment
Please, Sign In to add comment