Advertisement
Kaltazar

Function calling loop

Apr 24th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void loop() {
  2.   pressCount = buttonRead();
  3.   //Serial.println(pressCount);
  4.   switch (pressCount) {
  5.     case 1:
  6.     lightUp(pressCount);
  7.     motorRun(1);
  8.     break;
  9.  
  10.     case 2:
  11.     lightUp(pressCount);
  12.     motorRun(0);
  13.     break;
  14.  
  15.     case 3:
  16.     lightUp(pressCount);
  17.     motorRun(2);
  18.     break;
  19.  
  20.     case 4:
  21.     lightUp(pressCount);
  22.     motorRun(1);
  23.     break;
  24.  
  25.     default:
  26.     lightUp(0);
  27.     motorRun(0);
  28.     break;
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement