So I have started with the ESP8266 and it's been a rough ride. Everythime when I think I have, it fails. Last thing I did was install new firmware and all of a sudden I get normal words and strange chars.
My code:
#include <HardwareSerial.h>
#include <SoftwareSerial.h>
SoftwareSerial esp(2, 3); // RX, TX
void setup()
{
Serial.begin(9600);
esp.begin(115200);
connectoToWifi();
}
void connectoToWifi()
{
String SSIDstring = ("\"WIFI_NAME_HERE\"");
String PASSstring = ("\"WIFI_PASSWORD_HERE\"");
sendData("AT+RST\r\n", 1000, true);
sendData("AT+CWMODE=1\r\n", 500, true);
sendData("AT+CWJAP=" + SSIDstring + "," + PASSstring + "\r\n", 5000, true);
sendData("AT+CIPSTATUS\r\n", 500, true);
sendData("AT+CIFSR\r\n", 500, true);
sendData("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80\"", 500, true);
}
String sendData(String command, const int timeout, boolean debug)
{
String response = "";
esp.print(command); // Stuur een "lees" karakter naar de ESP.
long int time = millis();
while ((time + timeout) > millis())
{
while (esp.available())
{
char c = esp.read(); // Lees het volgende karakter.
response += c;
}
}
if (debug)
{
Serial.println(response);
}
return response;
}
void loop()
{
}
In my Serial monitor I see something like this:
I found this topic: viewtopic.php?f=32&t=2664&hilit=+coolterm
But it didn't fix it for me. I also tried like 30 other suggestions, but none seem to work. A few that keep coming back:
- Flash it (did that like 6 times)
- Change the baudrate of the esp (very popular)
- Check the connections
- Reset it, flash it, change baudrate
What am I missing here?