Skip to content

Instantly share code, notes, and snippets.

@fusspawn
Created January 18, 2018 16:13
Show Gist options
  • Save fusspawn/79f565fd5d6484adc922c04f7f2407ef to your computer and use it in GitHub Desktop.
Save fusspawn/79f565fd5d6484adc922c04f7f2407ef to your computer and use it in GitHub Desktop.
byte currentPot;
byte lastPot;
function between(byte value, byte min, byte max) : bool {
return (value >= min && value =< max);
}
bool isGoingUp = currentPot > lastPot;
if(isGoingUp && between(currentPot, 0, 25)) {
playSound("going_up_0_25.wav");
} else if(!isGoingUp && between(currentPot, 0, 25)) {
playSound("going_down_0_25.wav");
}
if(isGoingUp && between(currentPot, 25, 50)) {
playSound("going_up_25_50.wav");
} else if(!isGoingUp && between(currentPot, 25, 50)) {
playSound("going_down_25_50.wav");
}
// ect ect..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment