I ran into a trouble today while i was trying to make esp and arduino talk to each other. When I'm using Arduinos IDE serial port monitor and type commands by hand, everything is okay, but when i try to send these commands to esp from program it does nothing. Note that when im trying to make program work im disconnecting arduino from PC USB and use other power supply.
ESP is supplied from 5V powerbank but voltage is stabilised by LD1117. ESP TX and RX are connected directly to Arduino pins 0 and 1.
Here is the code:
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
SoftwareSerial dbs(9,10);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define SSID "kurczaki"
#define PASS ""
#define DST_IP "192.168.1.6"
#define PORT "3772";
void setup()
{
dbs.begin(57600);
lcd.begin(16,2);
Serial.begin(9600);
Serial.setTimeout(5000);
Serial.println("AT\r");
lcd.print("AT");
delay(5000);
if(Serial.find("OK"))
{
lcd.print(": OK");
Serial.println("AT+RST\r");
lcd.setCursor(0,1);
lcd.print("AT+RST");
delay(5000);
if(Serial.find("ready"))
{
lcd.print(": ready");
connectWifi();
}
else
{
lcd.print(": Error");
while(1);
}
}
else
{
lcd.print(": ERROR");
while(1);
}
}
void loop()
{
/*GET();
delay(10000);*/
}