I am trying to retrieve data from dht11 using esp8266 through CoAP but I receieved following error:
fatal error: net/rime/broadcast.h: No such file or directory
Details of error are:
Arduino: 1.8.5 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, All Flash Contents, 115200"
In file included from sketch\stunicast.h:76:0,
from sketch\runicast.h:81,
from sketch\collect.h:63,
from sketch\rime.h:49,
from sketch\contiki-net.h:61,
from sketch\coap-common.h:11,
from sketch\coapserver.h:7,
from C:\Users\labpc 7\Documents\Arduino\coap-server\coap-server.ino:6:
sketch\unicast.h:65:32: fatal error: net/rime/broadcast.h: No such file or directory
#include "net/rime/broadcast.h"
^
compilation terminated.
Multiple libraries were found for "ESP8266WiFi.h"
Used: C:\Users\labpc 7\Documents\Arduino\libraries\ESP8266WiFi
Not used: C:\Users\labpc 7\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266WiFi
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
If I solve the above error by removing net/rime/ from unicast.h file then another error of same type appears in the header file with name in which I made correction(in this case it will be broadcast.h). I go on doing this and solve one error but receive another error in another header file.
Can anyone help me to solve this dependency error of header file(I have named it)?
I am using below code in arduino:
/*
ESP-COAP Server
*/
#include <ESP8266WiFi.h>
#include "coapserver.h"
// CoAP server endpoint url callback
void callback_light(coapPacket &packet, IPAddress ip, int port, int obs);
coapServer coap;
//WiFi connection info
const char* ssid = "xxxxxxxxxxxx";
const char* password = "xxxxxxxxx";
// LED STATE
bool LEDSTATE;
// CoAP server endpoint URL
void callback_light(coapPacket *packet, IPAddress ip, int port, int obs) {
Serial.println("light");
// send response
char p[packet->payloadlen + 1];
memcpy(p, packet->payload, packet->payloadlen);
p[packet->payloadlen] = NULL;
Serial.println(p);
String message(p);
if (message.equals("0"))
{
digitalWrite(16, LOW);
Serial.println("if loop");
}
else if (message.equals("1"))
{
digitalWrite(16, HIGH);
Serial.println("else loop");
}
char *light = (digitalRead(16) > 0) ? ((char *) "1") : ((char *) "0");
//coap.sendResponse(packet, ip, port, light);
if (obs == 1)
coap.sendResponse(light);
else
coap.sendResponse(ip, port, light);
}
void callback_lightled(coapPacket *packet, IPAddress ip, int port, int obs) {
Serial.println("Lightled");
// send response
char p[packet->payloadlen + 1];
memcpy(p, packet->payload, packet->payloadlen);
p[packet->payloadlen] = NULL;
String message(p);
if (message.equals("0"))
LEDSTATE = false;
else if (message.equals("1"))
LEDSTATE = true;
if (LEDSTATE) {
digitalWrite(5, HIGH) ;
if (obs == 1)
coap.sendResponse("1");
else
coap.sendResponse(ip, port, "1");
//coap.sendResponse("1");
} else {
digitalWrite(5, LOW) ;
if (obs == 1)
coap.sendResponse("0");
else
coap.sendResponse(ip, port, "0");
//coap.sendResponse("0");
}
}
void setup() {
yield();
//serial begin
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println(" ");
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
//delay(500);
yield();
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.println(WiFi.localIP());
// LED State
pinMode(16, OUTPUT);
digitalWrite(16, HIGH);
LEDSTATE = true;
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
//LEDSTATE = true;
// add server url endpoints.
// can add multiple endpoint urls.
coap.server(callback_light, "light");
coap.server(callback_lightled, "lightled");
// coap.server(callback_text,"text");
// start coap server/client
coap.start();
// coap.start(5683);
}
void loop() {
coap.loop();
delay(1000);
}