Hey everybody
We are a group at Aalborg university (Denmark), who are making a project where we need two LED light to blink at two different frequensies, at the same time - how do we manage that?
Hey everybody
We are a group at Aalborg university (Denmark), who are making a project where we need two LED light to blink at two different frequensies, at the same time - how do we manage that?
Like so many other places, that site uses int when byte is more appropriate - why use 2 bytes of memory when 1 will do?
Getting away from the blink without delay theme, here's another way to do this part:
   if (ledState == LOW)
     ledState = HIGH;
   else
     ledState = LOW;
   digitalWrite(ledPin, ledState);
// use this before setup() : byte ledState = 0;
ledState = 1 - ledState; // then this toggles from 1 to 0 to 1 to 0 to 1 to 0 - no if/else needed
digitalWrite (ledPin, ledState);