Skip to content

Instantly share code, notes, and snippets.

@dean-shaff
Created September 14, 2015 05:51
Show Gist options
  • Save dean-shaff/91e151b0035816312278 to your computer and use it in GitHub Desktop.
Save dean-shaff/91e151b0035816312278 to your computer and use it in GitHub Desktop.
void loop() {
randNumber1 = random(0,100);
randNumber2 = random(0,100);
int bigger;
if (randNumber1 > randNumber2){
bigger = 1;
}else{
bigger = 0;
}
while (digitalRead(pin_in1) == HIGH){
if (bigger == 1 || digitalRead(pin_in2) == HIGH){
turn_on(pin_out1);
turn_on(pin_out2);
}else if (bigger == 0){
turn_off(pin_out2);
turn_off(pin_out1);
}
}
turn_off(pin_out1);
turn_off(pin_out2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment