DallasTemperature and OneWire

Discussion in 'Arduino IDE' started by imouro, Nov 11, 2013.

  1. imouro

    imouro New Member

    Joined:
    Oct 23, 2013
    Messages:
    9
    Likes Received:
    0
    Hi!

    I write one sketch this for test:

    Code:
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #define ONE_WIRE_BUS 40
    
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    
    void setup(void) {
    Serial.begin(9600);
    Serial.println("Dallas Temperature IC Control Library Demo");
    sensors.begin();
    }
    
    void loop(void) {
    Serial.print("Conected...");
    sensors.requestTemperatures();
    Serial.println("OK");
    Serial.print("Temperature: ");
    Serial.print(sensors.getTempCByIndex(0));
    
    }
    
    I import the libraries OneWire and DallasTemperature for Ardunio 1 in /home/ubuntu/Arduino/libraries

    When i see the serial Monitor I can not see nothing.

    If I comment the lines of sensors, the serial monitor show "conected .. OK. Temperature"

    In MEGA Ardunio this code works perfectly. Any suggestions?

    Thanks!
     
  2. imouro

    imouro New Member

    Joined:
    Oct 23, 2013
    Messages:
    9
    Likes Received:
    0
    any idea?
     
  3. delba

    delba Administrator Staff Member

    Joined:
    May 8, 2013
    Messages:
    1,064
    Likes Received:
    9
    Try using the Arduino DUE libraries. It has a different architecture than the Arduino UNO or Mega.
     
  4. marcinozog

    marcinozog New Member

    Joined:
    Nov 1, 2013
    Messages:
    4
    Likes Received:
    0
    I have the same problem, in my case i have a problem with float variables, e.g.

    void setup() {
    float f = 0.1;
    Serial.println(f);
    }

    it crashes my ardu in udoo, when i replace float to int in DallasTemperature then it work, sometimes when i use sprintf then crash it, sorry for my en
     
  5. simcode

    simcode New Member

    Joined:
    Dec 2, 2013
    Messages:
    8
    Likes Received:
    0
    I have the same problem.

    if i use Serial.println then stop process
     
  6. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    Correction to my earlier post.

    The 'Serial' library is documented as supporting "any data type" (not sure they mean that literally, but for sure Strings and Floats are supposed to work out of the box). Clearly it doesn't.

    Here is an example of a workaround - use an array of chars with a Null terminator.

    char myTestString [ ] = "Test string\0";
    Serial.println(myTestString);
     
  7. simcode

    simcode New Member

    Joined:
    Dec 2, 2013
    Messages:
    8
    Likes Received:
    0
    thank you.

    but i don't run.

    if i use Serial library then stop process
     
  8. nicoj10

    nicoj10 New Member

    Joined:
    Jan 11, 2014
    Messages:
    2
    Likes Received:
    0
    Hi,
    i have the same problem (no output on serial with those libraries) and i hope it gets fixed soon. I don't understand why it works on my normal Due and not on the UDOO. I don't know how to change my code in order to make it work.

    Code:
    #include <OneWire.h>
    #include <DallasTemperature.h>
    
    
    #define ONE_WIRE_BUS 3
    
    
    int led_temp = 9;
    
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    DeviceAddress Thermometer_1 = {0x28, 0xF9, 0xE2, 0x20, 0x05, 0x00, 0x00, 0xE6};
    
    void setup() {
      
      Serial.begin(9600);
    
    pinMode(led_temp,OUTPUT);
      sensors.begin();
      // Einstellung der Aufl?sung auf 10 bit 
      sensors.setResolution(Thermometer_1, 10);
    }
    
    void loop() {
      sensors.requestTemperatures();
      float Temperatur_1 = sensors.getTempC(Thermometer_1);
      Serial.print("0");
      Serial.print("#");
      Serial.println(Temperatur_1);
        if(Temperatur_1>23)
        {
          digitalWrite(led_temp,HIGH);
        }
        else
        {
          digitalWrite(led_temp,LOW);
        }
    
        delay(1000);
    }
    
     
  9. Miika

    Miika New Member

    Joined:
    Jan 26, 2014
    Messages:
    2
    Likes Received:
    0
    I've tried pretty much every trick in the book to get anything with onewire.h or dallastemp.h libraries to work but I'm always greeted with
    errors

    In file included from one_wire_address_finder.pde:7:0:
    /opt/arduino-1.5.4/libraries/OneWire/OneWire.h:77:2: error: #error "Please define I/O register types here"
    /opt/arduino-1.5.4/libraries/OneWire/OneWire.h:84:5: error: 'IO_REG_TYPE' does not name a type
    /opt/arduino-1.5.4/libraries/OneWire/OneWire.h:85:14: error: 'IO_REG_TYPE' does not name a type

    I've tried different library versions and so forth but so far no luck. On Windows 7 computer with arduino 1.0.5 and 1.5.5 rc2 everything works just fine.

    What the heck is wrong with the udoo arduino ide?
     
  10. acsabir

    acsabir New Member

    Joined:
    Mar 28, 2014
    Messages:
    3
    Likes Received:
    0
    Try updating OneWire and DallasTemperature libraries to most recent one. That worked for us.
     

Share This Page