Hi, I connected ESP8266 with arduino Leonardo. ESP takes data from my website and it works and I want to send it to my arduino (RX TX) and it works but not correct. ESP can get only data "off" or "on" but on my monitor serial i see
O
O
O
N
O
N
O
N
O
N
O
N
O
N
O
N
O
N
O
N
O
O
O
N
My code for arduino
char nowStatus;
char prevStatus;
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
void setup() {
pinMode(0, OUTPUT);
Serial.begin(115200);
while (!Serial) {}
Serial.println("Goodnight moon!");
mySerial.begin(115200);
mySerial.println("Hello, world?");
}
void loop() {
if (mySerial.available()) {
char input = mySerial.read();
Serial.println(input);
}
}
AND MY CODE FOR ESP
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
const char* ssid = "xxx";
const char* password = "xxx";
ESP8266WebServer server(80);
void setup(void){
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
}
void loop(void){
HTTPClient http; //Declare object of class HTTPClient
String getData, Link;
getData = "?status=current";
Link = "http://www.example.pl/test.php" + getData;
http.begin(Link); //Specify request destination
int httpCode = http.GET(); //Send the request
String payload = http.getString(); //Get the response payload
Serial.println(payload); //Print request response payload
http.end(); //Close connection
delay(500);
}
Serial.begin(115200) the same for arduino and ESP. Are you able to tell me where is the problem?