-->
Page 1 of 2

Arduino and ESP works with hands, does not work with code

PostPosted: Thu Jan 22, 2015 4:45 pm
by andrzeju
Hi all im new on this forum.

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:
Code: Select all#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);*/
}

Re: Arduino and ESP works with hands, does not work with cod

PostPosted: Thu Jan 22, 2015 5:25 pm
by andrzeju
I figured out that i have to flash esp bacause of this line after AT+RST:
[Vendor:www.ai-thinker.com Version:0.9.2.4]
is that correct?

Re: Arduino and ESP works with hands, does not work with cod

PostPosted: Thu Jan 22, 2015 5:32 pm
by iHaveESP
The Serial.println("blahblah"); function already adds the CR and LF. You don't need the "\r". I would update to the latest firmware. A good place to start is here:http://www.electrodragon.com/w/Wi07c

Re: Arduino and ESP works with hands, does not work with cod

PostPosted: Mon Mar 02, 2015 9:40 am
by loomis
@andrzeju (PL ?) Any progress? I have same problem...