Problems with Serial.println and float ?

Discussion in 'Arduino IDE' started by scanlancs, Dec 20, 2013.

  1. scanlancs

    scanlancs New Member

    Joined:
    Jul 4, 2013
    Messages:
    4
    Likes Received:
    0
    Hi,

    Can someone please tell me what I am doing wrong, I can not print float numbers to the serial monitor.

    void setup() {
    Serial.begin(9600);
    }

    void loop() {
    int sensorValue = analogRead(A0);
    Serial.println(sensorValue); // Works up to here but add a float and nothing.

    float myFloat;
    myFloat = 10.05;
    Serial.println(myFloat);

    delay(300);
    }

    What I was trying to do was read pin 0 with a voltage divider and * it by the byte code to get the correct value. But what I found was any Serial.print of a float and nothing displays on the serial monitor. If i stick to int it's ok but * / or any thing else and nothing.

    Want to put the UDOO in my power shed and get real time sensor and power data.

    I am new to Linux & the Due but have been successful with Uno until I put 12 volts into the 5 volt rail. (Still learning).

    Thanks Chris.
     
  2. andcmp

    andcmp New Member

    Joined:
    May 8, 2013
    Messages:
    161
    Likes Received:
    0
    Hi Chris,

    have a look here: viewtopic.php?f=15&t=493&p=3940&hilit=float#p3940

    The UDOO team is looking in to it to solve the problem, there's something wrong with the compiler.
    And update will be released soon in order to solve the problem.
     
  3. taylo1g

    taylo1g New Member

    Joined:
    Oct 30, 2013
    Messages:
    8
    Likes Received:
    1
    For a better immediate solution, please see this post:

    http://www.udoo.org/forum/viewtopic.php?f=15&t=526

    Uploading the Arduino code from an external computer allows the code to function properly. Hopefully this issue is solved soon, since being able to program the Arduino IC from the UDOO itself was a big selling point for this device...
     
  4. scanlancs

    scanlancs New Member

    Joined:
    Jul 4, 2013
    Messages:
    4
    Likes Received:
    0
    Hi "andcmp",

    I had a look at that post but did not understand the thread entirely.
    I am still new to this, but I am enjoying myself learning about electronics, programming & about Linux.

    I will use "taylo1g" suggestion and program UDOO external, as it is the only micro-controller I have now as I damaged my Arduino Uno. Hope it is only the chip that's damaged.

    If I modify the Arduino IDE so it will work with the UDOO dose that mean it will not work with other micro-controllers.

    Thank for you help.

    Regards,

    Chris.
     
  5. gokumars

    gokumars New Member

    Joined:
    Feb 22, 2014
    Messages:
    5
    Likes Received:
    0
    Don't forget to mention you also have to reboot the entire system after each program of an external source, not just the sam3x

    Is there a fix yet?
     

Share This Page