MrAlvin

arduino - very basic state-machine

Mar 18th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. int idx = 1;
  2.  
  3. void timed_action() {
  4.   switch(idx){
  5.     case 1: //turn on one led
  6.       idx++;
  7.       break;
  8.     case 2: //turn on two leds
  9.       idx++;
  10.       break;
  11.     case 3: //turn on three leds
  12.       idx++;
  13.       break;
  14.     case 4: //turn on four leds
  15.       idx++;
  16.       break;
  17.     case 5: //no changes
  18.       break;
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment