We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1872b5 commit 7a5a154Copy full SHA for 7a5a154
button_on.ino
@@ -0,0 +1,35 @@
1
+#include <Adafruit_NeoPixel.h>
2
+#define PIN 7
3
+#define NUM_LEDS 4
4
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
5
+int buttonApin = 8;
6
+
7
+void setup()
8
+{
9
+ pinMode(buttonApin, INPUT_PULLUP);
10
+ strip.begin();
11
+ strip.show();
12
+}
13
14
+void loop()
15
16
+ if (digitalRead(buttonApin) == LOW)
17
+ {
18
+ strip.setPixelColor(0, 10, 0, 0);
19
+ strip.setPixelColor(1, 0, 0, 0);
20
+ strip.setPixelColor(2, 0, 0, 0);
21
+ strip.setPixelColor(3, 0, 0, 0);
22
23
+ delay(1);
24
+ }
25
+ if (digitalRead(buttonApin) == HIGH)
26
27
+ strip.setPixelColor(0, 0, 0, 0);
28
29
30
31
32
33
34
35
0 commit comments