hi everyone
i am new to this forum.....
i am having problem in reading data sent by arduino to esp8266..
can anyone guide me on this plz
thank you.
hi everyone
i am new to this forum.....
i am having problem in reading data sent by arduino to esp8266..
can anyone guide me on this plz
thank you.
Yes of course. Start by looking at How to use the forum. That will tell you exactly what and how you need to post in order for us to help
i am having problem in reading data sent by arduino to esp8266..
Where is the data coming from ?
Where do you want to see it ?
Where is the data coming from ?
atmega328p will send '1' on the serial monitor..
Where do you want to see it ?
in ESP8266.
OK. Let's see your programs for both ends of the link and details of how the 2 systems are connected and powered.
first of all i am using RobotDyn uno wifi board where ESP8266 is in build.
so communication between atmega and esp8266 will heppen when i toggle the switches 1 and 2 on.
esp8266 code
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ArduinoJson.h>
#include <ESP8266HTTPClient.h>
#define USE_SERIAL Serial
ESP8266WiFiMulti WiFiMulti;
int i=0;
const size_t bufferSize = JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(8) + 370;
DynamicJsonBuffer jsonBuffer(bufferSize);
void setup()
{
USE_SERIAL.begin(9600);
//USE_SERIAL.setDebugOutput(true);
//USE_SERIAL.println();
//USE_SERIAL.println();
//USE_SERIAL.println();
for(uint8_t t = 4; t > 0; t--)
{
//USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
//USE_SERIAL.flush();
delay(1000);
}
WiFi.begin("DIGISOL","edot2018");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
//Serial.print(".");
}
//Serial.println("");
//Serial.println("WiFi connected");
//Serial.println("IP address: ");
//Serial.println(WiFi.localIP());
}
void loop()
{
// wait for WiFi connection
// if((WiFiMulti.run() == WL_CONNECTED)) {
while(Serial.available() == 0){}
int command = Serial.parseInt();
if(command == 1){
HTTPClient http,http2;
//USE_SERIAL.print("[HTTP] begin...\n");
// configure traged server and url
http.begin("http://192.168.1.12/FlightStats/api/Flight/GetArrivingFlightsStatus/"); //HTTP
http2.begin("http://192.168.1.12/FlightStats/api/Flight/GetDepartingFlightsStatus/");
//start connection and send HTTP header
int httpCode = http.GET();
int httpCode2 = http2.GET();
// httpCode will be negative on error
if(httpCode == 200 )
{
// HTTP header has been send and Server response header has been handled
//USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
//USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode2);
String myString = http.getString();
String myString2 = http2.getString();
JsonObject& root = jsonBuffer.parseObject(myString);
const String description = root["Description"];
JsonObject& root1 = jsonBuffer.parseObject(myString2);
const String description2 = root1["Description"];
USE_SERIAL.println(description);
USE_SERIAL.println(description2);
}
else
{
USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
delay(10000);
}
}
atmega code
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println('1');
if(Serial.available() > 0)
{
ATSTART();
draw();
}
else if (cycled == 1)
{
count=0;
draw();
}
else
{
ATSTART();
draw();
}
delay(1000);
}
i am able to send data from ESP8266 to atmega using serial monitor , but m not able to the other way round.