Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot use anything else than simple conditions
10-01-2013, 09:35 PM, (This post was last modified: 10-01-2013, 09:40 PM by matias.)
#1
Cannot use anything else than simple conditions
Hi. Anyone knows if I am hitting a limitation or something? Because

Code:
if (a == b) ...

works, but

Code:
if (c < a && a < d) ...

breaks my program on the chip, even though it always compiles on my computer.

I am using IDE x.4 and board 26J50.
Reply
16-01-2013, 12:24 AM,
#2
RE: Cannot use anything else than simple conditions
Hi, matias

This code works well.
Code:
void setup() {
    pinMode( USERLED, OUTPUT);
    digitalWrite( USERLED, 0);
}

int a=0,c=10,d=30;
void loop() {
    if (c < a && a < d){
       digitalWrite( USERLED, 1);
       CDC.printf("\n\r Match a=%d", a);
    }
    else{
        digitalWrite( USERLED, 0);
        CDC.printf("\n\r Unmatch a=%d", a);
    }  
    if ( a > (d+10) ){a = 0; }
    a++;
    CDC.printf(" "); // To be stable CDC connection.
    delay(200);
}

Windows7
IDE X.4 rev.684
board 26j50

avrin
Reply
17-01-2013, 10:41 PM,
#3
RE: Cannot use anything else than simple conditions
Thanks avrin for your answer. It turns out that the sample code you provided does not compile on my platform, for my surprise. So, I better check what is happening with my installation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)