Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. exception and stacktrace when calling sensors.requestTemperatures();

exception and stacktrace when calling sensors.requestTemperatures();

Scheduled Pinned Locked Moved My Project
2 Posts 1 Posters 802 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mysensors-6043M Offline
    mysensors-6043M Offline
    mysensors-6043
    wrote on last edited by
    #1

    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);

    }

    1 Reply Last reply
    0
    • mysensors-6043M Offline
      mysensors-6043M Offline
      mysensors-6043
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      9

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular