Go Down

Topic: Arduino and ESP8266 (Read 37 times) previous topic - next topic

jellyfish7

I have the ESP8266 connected to my Arduino Uno.  With a blank sketch I can use Serial Monitor to connect it to my wifi network using these commands

AT+IPR=9600
AT+CWMODE=1
AT+CWJAP="SSID_HERE",""


It get's an ip and everything.  But now I want my sketch to just do this using this code

#include <SoftwareSerial.h>

#define SSID "SSID_HERE"

void setup(){
  Serial.begin(9600);
  Serial.setTimeout(5000);
  delay(1000);
}

boolean connectWiFi()
{

 // connect
  Serial.println("AT+CWMODE=1");
  Serial.println("AT+CWJAP=\"SSID_HERE\",\"\"");
  delay(2000);
  if(Serial.find("OK"))
  {
    Serial.println("AT+CIFSR");
    Serial.flush();
    delay(1000);
    return true;
  }
  else
  {
    // Can not connect to the WiFi.
    return false;
  }
}


But it doesn't work.. The Serial.println doesn't seem to get a response from the ESP8266. What am I missing?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy