DS18B20 показывает 85* И это не нормально

Тема в разделе "Arduino & Shields", создана пользователем sasha294, 8 окт 2018.

  1. sasha294

    sasha294 Нерд

    Возможно ли его настраивать или нет
    Код (C++):
    // Include the libraries we need
    #include <OneWire.h>
    #include <DallasTemperature.h>

    // Data wire is plugged into port 2 on the Arduino
    #define ONE_WIRE_BUS 2

    // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    OneWire oneWire(ONE_WIRE_BUS);

    // Pass our oneWire reference to Dallas Temperature.
    DallasTemperature sensors(&oneWire);

    /*
    * The setup function. We only start the sensors here
    */

    void setup(void)
    {
      // start serial port
      Serial.begin(9600);
      Serial.println("Dallas Temperature IC Control Library Demo");

      // Start up the library
      sensors.begin();
    }

    /*
    * Main function, get and show the temperature
    */

    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");
      // After we got the temperatures, we can print them here.
      // We use the function ByIndex, and as an example get the temperature from the first sensor only.
      Serial.print("Temperature for the device 1 (index 0) is: ");
      Serial.println(sensors.getTempCByIndex(0));
    }
     
  2. ImrDuke

    ImrDuke Гик

    Это значит нет контакта. Проверяйте, может где то провод отвалился.
     
    b707 нравится это.
  3. b707

    b707 Гуру

    И добавлю к предыдущему сообщению - чтобы не гадать, что такое 85 - темпеартура или ошибка - проверяйте CRC данных, приходящих с датчика, в даташите все указано.
     
  4. sasha294

    sasha294 Нерд

    нет контакта это -127
     
  5. b707

    b707 Гуру

    ну тогда ошибка передачи или что-то подобное. В любом случае, "85" - известное значение, обозначающее. что данные с датчика не приходят.
     
  6. ИгорьК

    ИгорьК Гуру

    85 - загружается в ячейки температуры датчика при подаче питания.
    После передачи правильной команды на чтение температуры там должны быть данные температуры.
    Если их там нет - ошибка команды на чтение температуры.
     
    Последнее редактирование: 9 окт 2018
    Ariadna-on-Line нравится это.
  7. sasha294

    sasha294 Нерд

    ошибка моя я не подпаял +