exception and stacktrace when calling sensors.requestTemperatures();
-
Hi Community
Based on a nodeMCU the Gateway is running and passes data over the WLAN to an iobroker instance of mysensors.
There is a DS18B20 connected and temperature value can be read with the arduino IDE sample script.
The same code is inserted to the Gateway script. As soon as I call sensors.requestTemperature(), I get an exception and a stack trace.OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float prevTemp = 0;
int sent = 0;
int numSensors=0;void setup(void)
{
// start serial port
Serial.begin(115200);
Serial.println("Dallas Temperature IC Control Library Demo");// Start up the library
sensors.begin();
}void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Temperature Sensor", "1.1");
// Fetch the number of attached temperature sensors
numSensors = sensors.getDeviceCount();
// Present all sensors to controller
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
present(i, S_TEMP);
}
}void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print(" Requesting temperatures...");
//sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");Serial.print("Temperature for Device 1 is: ");
//Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"?
// You can have more than one IC on the same bus.
// 0 refers to the first IC on the wiredelay(1000);
}
-
Hmm, as soon as I omit including <MySensors.h> it works. I use mysensors 2.0 in Arduino IDE
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login