hi there, it seems the compiler is making something strange with this minimum working example code:
int hundreds;
short pixel;
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
hundreds = 0;
if ((hundreds > 888) && (hundreds <= 0)) {
pixel = 2;
}else if ((hundreds > 111) && (hundreds <= 222)) {
pixel = 3;
}else if ((hundreds > 222) && (hundreds <= 333)) {
pixel = 4;
}else if ((hundreds > 333) && (hundreds <= 444)) {
pixel = 5;
}else if ((hundreds > 444) && (hundreds <= 555)) {
pixel = 6;
}else if ((hundreds > 555) && (hundreds <= 666)) {
pixel = 7;
}else if ((hundreds > 666) && (hundreds <= 777)) {
pixel = 0;
}else if ((hundreds > 777) && (hundreds <= 888)) {
pixel = 1;
} else {
pixel = 8;
}
Serial.println(hundreds);
Serial.println(pixel);
}
The code never goes into the first if statement and rather goes into the else which is basically wrong due to (hundreds > 888) && (hundreds <= 0) is true . Where is the problem here?