SHARE
TWEET

Function calling loop

Kaltazar Apr 24th, 2019 79 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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top