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 wire

    delay(1000);

    }



  • Hmm, as soon as I omit including <MySensors.h> it works. I use mysensors 2.0 in Arduino IDE


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.