My script causes a lockup

Discussion in 'General Programming Discussion' started by taylo1g, Dec 2, 2013.

  1. taylo1g

    taylo1g New Member

    Joined:
    Oct 30, 2013
    Messages:
    8
    Likes Received:
    1
    There seems to be an issue with not only floating point math operations and printing the results, but I can't even get simple arithmetic to work if variables are used...

    I've tried to read analog values and perform simple math operations on the variables holding these values, but the Arduino keeps locking up on me. For example, with the following code:

    Code:
    int analogPin = 1;
    int val = 0;
    int val2 = 0;
    
    void setup() {
      Serial.begin(9600);
    }
    
    void loop() {
    
      val = analogRead(analogPin);
      Serial.print("val = ");
      Serial.println(val);
     
      val2 = val + 5;
      Serial.print("val2 = ");
      Serial.println(val2);
     
      delay(1000);
    }
    The program will hang up once it reaches the val2 definition.

    I've tried both Linaro Ubuntu 11.10 (image version 1.3) and 12.04 LTS (image version 2.0), but I get the same hanging up with both. Is there some sort of update to the Arduino IDE 1.5.4 that I need to install?

    FYI...I'm using a UDOO Dual Lite.
     
  2. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    Re: It seems floating point is bad?

    Try switching from Pin 1 to using Pin 2, let us know how you get on after that.

    P.S. Please don't hijack someone else post unless it's a shared thread (like the HDMI Offical Issues thread) or you have exactly the same issue, it just confuses the issue.
     
  3. jdonavan

    jdonavan New Member

    Joined:
    Oct 28, 2013
    Messages:
    34
    Likes Received:
    0
    I wasn't hijacking... The issue is the Serial class is causing the Arduino to lock up. FFS the example code from the Udoo blog doesn't even work for the same reason...
     

Share This Page