two versions

This commit is contained in:
ladyada 2017-10-13 00:49:16 -04:00
parent fb9dfacafd
commit 6b657eecfc
2 changed files with 21 additions and 5 deletions

View file

@ -1,16 +1,16 @@
#include <Adafruit_CircuitPlayground.h>
void setup() {
// Initialize the circuit playground
CircuitPlayground.begin();
pinMode(CPLAY_LEFTBUTTON, INPUT_PULLDOWN);
pinMode(CPLAY_REDLED, OUTPUT);
}
void loop() {
// If the left button is pressed....
if (CircuitPlayground.leftButton()) {
CircuitPlayground.redLED(HIGH); // LED on
if (digitalRead(CPLAY_LEFTBUTTON)) {
digitalWrite(CPLAY_REDLED, HIGH); // LED on
} else {
CircuitPlayground.redLED(LOW); // LED off
digitalWrite(CPLAY_REDLED, LOW); // LED off
}
}

View file

@ -0,0 +1,16 @@
#include <Adafruit_CircuitPlayground.h>
void setup() {
// Initialize the circuit playground
CircuitPlayground.begin();
}
void loop() {
// If the left button is pressed....
if (CircuitPlayground.leftButton()) {
CircuitPlayground.redLED(HIGH); // LED on
} else {
CircuitPlayground.redLED(LOW); // LED off
}
}