I have used ESP8266 to monitor Temperature and Humidity and it works.
When i use the same code with ESP8266 v3.0, it doesn’t work.
It doesnt read data from sensor.
Why is happening this ?
I have used ESP8266 to monitor Temperature and Humidity and it works.
When i use the same code with ESP8266 v3.0, it doesn’t work.
It doesnt read data from sensor.
Why is happening this ?
@shramik_salgaonkar @grigoreeugen1
Can you help me ?
are you referring to nodemcu? well, i dont see any difference between the two other then usb to serial chip. you can try and see if you are able to read the sensor data without the cayenne code.
I have tried to read data without the cayenne code, but it is not working.
I have four pieces ESP8266 NodeMCU, and i have the same problem with all of them.
can you share the code you are using and the link to the device.
This is the code. This code is working with my old NodeMCU (ESP8266 v2).
Sensor ------> NodeMCU
Power --------->VIN
GND -------->GND
SIGNAL ------->12 (D6)
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include “DHT.h”
#define DHTPIN 12 // modify to the pin we connected
#define DHTTYPE AM2301 // AM2301
DHT dht(DHTPIN, DHTTYPE);
// WiFi network info.
char ssid = “******";
char wifiPassword[] = "”;
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “";
char password[] = "";
char clientID[] = "***************************”;
unsigned long lastMillis = 0;
void setup() {
Serial.begin(115200);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
dht.begin();
}
void loop() {
Cayenne.loop();
//Publish data every 10 seconds (10000 milliseconds). Change this value to publish at a different interval.
if (millis() - lastMillis > 10000) {
lastMillis = millis();
//Write data to Cayenne here. This example just sends the current uptime in milliseconds.
Cayenne.virtualWrite(0, lastMillis);
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
Cayenne.celsiusWrite(1, temperature);
Cayenne.virtualWrite(2, humidity, "rel_hum", "p");
}
}
//Default function for processing actuator commands from the Cayenne Dashboard.
//You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}
what is this?
This code is working with my old NodeMCU.
#define DHTTYPE AM2301 // AM2301…The code is not working without this. You helped me to write this code.
can you share the link of where I have shown you?
And i pretty sure the code does not work for v2.0 also as you are stating it works.
Hmmm…We have sent each other many messages, i cant find it. But i am sure that the code has not worked without that line.
Do you know why it is not working with ESP8266 v3 ?
please share the link or screenshot of the message. i want to check if i gave you the code. it might be a reason for giving it and i can get it in the link.
I found our messages, but i have written that line. Sorry.
The code is not working without that line.
Can you help me to solve this problem ?
what do you mean by it, i did not understand.
I dont understand.
I have a problem and i asked you if you can help me.
but i dont understand where you got this line, so I am not sure how I can help you.
Sir, i found it on internet.
can you link from where you got it? or link me to the code i shared.
I didn’t saved the link. You didn’t send it to me. I told you.
Will you help me or not ?
well, you should atleast think before making a comment. Also it is a good idea to save the useful link in bookmark.
if you could atleast search for earlier message then you could have got the code that i gave Esp8266 + am2301 + sd card - #6 by shramik_salgaonkar
I told you that i found our messages and you didn’t sent me that line of code. I said SORRY for that.
I think i cant do anything more about that.