Go Down

Topic: Processing and teensy arduino problem (Read 7066 times) previous topic - next topic


arduino IDE doesn't like "if(serial.available()>=4);

Why are you putting a semicolon at the end of an if statement? That forms the body of the if statement, and is, effectively a no-op. Do nothing if the statement is true. Do nothing if the statement is false.

By the way, surely you know that the Serial instance uses a capital S.
The art of getting good answers lies in asking good questions.



i have numbers in black window of processing when i run these 3 lines but only with this line in arduino IDE:

but my strip led light in wrong colour, only white with glitter

arduino IDE doesn't like "if(serial.available()>=4);

Your arduino is expecting 4 bytes at a time, the original code you posted was correct.  Proofread this part VERY carefully.  If "the IDE doesn't like it" and shows an error when you hit "Verify", then proofread it again VERY carefully :)
Code: [Select]

//protocol expects data in format of 4 bytes
//(xff) as a marker to ensure proper synchronization always
//followed by red, green, blue bytes
if (Serial.available()>=4) {
   if(Serial.read() == 0xff){
      red = Serial.read();
      green= Serial.read();
      blue = Serial.read();

Go Up