Reputation: 1184
I'm using an Arduino Uno Rev3 with ESP8266 to connect into a network and send some data through TCP sockets. I'm using the following code to establish a connection
boolean connectWifi() {
String cmd = "AT+CWJAP=\"";
cmd += SSID;
cmd += "\",\"";
cmd += PASS;
cmd += "\"";
Serial.flush();
Serial.println(cmd);
delay(5000);
if(Serial.find("OK")) {
Serial.println("Connected");
return true;
} else {
Serial.println("Not connected");
return false;
}
}
but everytime I call this function inside the arduino loop(), I receive "Not connected".
I have already tried to connect direct from serial monitor running an empty code on Arduino and this AT command worked very well. Someone have any idea about what is wrong?
Connections:
(Used when I need to send commands right from arduino code)
Arduino ------------ ESP8266
3.3v --------------------- vcc
gnd ---------------------- gnd
3.3v ------------------- CH_PD
TX ------------------------ RX
RX ------------------------ TX
(Used when I need to send commands right from arduino serial monitor)
Arduino ------------ ESP8266
3.3v --------------------- vcc
gnd ---------------------- gnd
3.3v ------------------- CH_PD
TX ------------------------ TX
RX ------------------------ RX
Upvotes: 2
Views: 2661
Reputation: 11
i also have the same problem, try the code below maybe it works (the esp should be connected to arduino's pins except rx and tx , i use pin number 7 and pin number 8)
#include <SoftwareSerial.h>
SoftwareSerial esp(7, 8);// TX, RX
void setup()
{
esp.begin(115200);
Serial.begin(9600);
}
void loop()
{
//put your code here
}
Upvotes: 0
Reputation: 1184
I just uploaded blank.bin into ESP and everything worked fine. There was some example code in conflict with Arduíno.
Upvotes: 2
Reputation: 448
You will need more power to make it work properly. Maybe this will help:
http://makezine.com/2015/04/01/installing-building-arduino-sketch-5-microcontroller/
(check out the: build a voltage divider out of resistors, from the article)
Upvotes: 0