Skip to content

Instantly share code, notes, and snippets.

@manekinekko
Last active January 27, 2019 14:15
Show Gist options
  • Save manekinekko/333c7f41b9d5654453708b3327c83d1c to your computer and use it in GitHub Desktop.
Save manekinekko/333c7f41b9d5654453708b3327c83d1c to your computer and use it in GitHub Desktop.
const int led1Pin = 13; // LED1 for Mode 1
const int led2Pin = 12; // LED2 for Mode 2
const int btn1Pin = 4;
const int btn2Pin = 3;
void setup() {
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pinMode(btn1Pin, INPUT);
pinMode(btn2Pin, INPUT);
}
void loop() {
int btn1Status = digitalRead(btn1Pin);
int btn2Status = digitalRead(btn2Pin);
if (btn1Status == HIGH) { // if the button 1 is pressed
digitalWrite(led1Pin, HIGH); // will wake the controller up
delay(800);
digitalWrite(led1Pin, HIGH); // will trigger the signal
}
else {
digitalWrite(led1Pin, LOW);
}
if (btn2Status == HIGH) { // if the button 2 is pressed
digitalWrite(led2Pin, HIGH); // will wake the controller up
delay(1000);
digitalWrite(led2Pin, HIGH); // will trigger the signal
}
else {
digitalWrite(led2Pin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment