Hi,
Ik ben met de ESP8266 aan het spelen, leuk ding. Ik heb echter wat problemen met het doorzetten van commando's en terug ontvangen van responses. De aansluitingen zijn zoals aangegeven in de SCHEMA.png.
Wanneer ik de softwareserial via de monitor bekijk dan krijg ik de volgende output (9600Baud)
DEBUG TEST
õõõõ //*allemaal vage tekens die niet correct copy/paste worden
õõõ //*allemaal vage tekens die niet correct copy/paste worden
õõ //*allemaal vage tekens die niet correct copy/paste worden
DEBUG TEST is wat ik zelf meegeef. De 'onzin' tekens is wat vanuit de ESP naar de Arduino is verstuurt.
Wanneer ik de RX/TX bekijk van de arduino dan worden de commands correct verstuurd:
AT+RST
AT+CWMODE=3
AT+CWSAP='raoul', 'none','11','0'
Het zal waarschijnlijk aan de baudrate tussen de ESP en arduino liggen, ik kan echter niet de juiste vinden.
Hebben jullie misschien een idee of ik nog iets anders over het hoofd zie?
#include <SoftwareSerial.h>
SoftwareSerial USBdebug(10,11); // make RX Arduino line is pin 2, make TX Arduino line is pin 3.
// This means that you need to connect the TX line from the esp to the Arduino's pin 2
// and the RX line from the esp to the Arduino's pin 3
void setup()
{
USBdebug.begin(9600);
Serial.begin(57600); // your esp's baud rate might be different
USBdebug.println("DEBUG TEST");
Serial.println("AT+RST");
delay(1000);
Serial.println("AT+CWMODE=3"); // SET UP AS ACCESPOINT AND STANDARD
Serial.println('AT+CWSAP="raoul", "none","11","0"');
}
void loop()
{
if(Serial.available()) // check if the esp is sending a message
{
String response = "";
while(Serial.available())
{
// The esp has data so display its output to the USBdebug window
response+=(char)Serial.read();
}
USBdebug.println(response);
}
if(USBdebug.available())
{
// the following delay is required because otherwise the arduino will read the first letter of the command but not the rest
// In other words without the delay if you use AT+RST, for example, the Arduino will read the letter A send it, then read the rest and send it
// but we want to send everything at the same time.
String command="";
while(USBdebug.available()) // read the command character by character
{
// read one character
command+=(char)USBdebug.read();
}
if (command =="STATUS123")
{
Serial.println("AT+CIPSTATUS");
} else
{
Serial.println(command); // send the read character to the Serial
}
}
}