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 1.0k 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

      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      12

      Online

      12.0k

      Users

      11.2k

      Topics

      113.4k

      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