Guest User

Untitled

a guest
Aug 20th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. How do I use this variable in if statement in a loop (scope)
  2. int i = 0;
  3.  
  4. void loop()
  5. {
  6. //Set The output pin to the MIDI note number - 60.
  7. int pinNumber = noteNumber - 60;
  8.  
  9. if (midiMessage == 144) {
  10. if (velocity == Triggered) {
  11. registerWrite(pinNumber, HIGH);
  12. i = pinNumber;
  13. }
  14. }
  15.  
  16. if (midiMessage == 128) {
  17. if ((i % 8) == (pinNumber % 8)) {
  18. if (velocity == Stopped) {
  19. registerWrite(pinNumber, LOW);
  20. }
  21. }
  22. }
  23. }
  24.  
  25. void loop (void) {
  26. static int persistentVar = 0;
  27. :
  28. :
  29. }
Add Comment
Please, Sign In to add comment