CPX Switch code
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Yeetmaster4628
- Posts: 1
- Joined: Fri May 05, 2023 11:18 pm
CPX Switch code
I can't solve this coding problem. I am making a metronome and I am making it so that when the switch is on the left hand side, it repeats a certain pattern for 1e+150 times and when the switch is on the right side, it repeats another pattern for 1e+150 times. But whenever I switch the switch left to right and vice versa, the two separate codes overlap. I want to make it so that when the switch is on the left hand side, only the code for the "on switch moved left" is being executed and when the switch is moved to the right hand side, it completely stops the "on switch moved left" codes and just executes the "on switch moved right" codes. Please help ASAP.
- Attachments
-
- Screen Shot 2023-05-06 at 12.24.27 PM.png (261.02 KiB) Viewed 130 times
- johnpark
- Posts: 966
- Joined: Wed Mar 25, 2009 2:15 pm
Re: CPX Switch code
You could create a conditional if statement that essentially stops playback on one pattern when you flip the switch and vice versa. Here's a simplified version of it:
Please be positive and constructive with your questions and comments.