From 051ad41ce8f8a2fa018d152ae32e5c5fd30ec8d9 Mon Sep 17 00:00:00 2001 From: Mcen21 <32722839+Mcen21@users.noreply.github.com> Date: Mon, 16 Oct 2017 19:57:17 -0400 Subject: [PATCH] Add random code --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 57970f4..bedb1d5 100644 --- a/README.md +++ b/README.md @@ -1 +1,27 @@ -# Arduino-Repository- \ No newline at end of file +#include +#ifdef __AVR__ +#include +#endif + +int const NUM_PIXELS = 12; +int8_t const PIN= 13; +Adafruit_NeoPixel strip; + +void steup() { + strip = Adafruit_NeoPixel(NUM_PIXELS, PIN, NEO_GRB+NEO_KHZ800); + strip.begin(); + strip.show(); // Init all pixels to "off" + + pinMode(2, INPUT_PULLUP); +} + +void loop() { + // Colors are defined in 0xRRGGBB format. + int sensorValue = digitalRead(2); + if (sensorValue == 0) { + strip.setPixelColor(0, 0x400000); + } else { + strip.setPixelColor(0, 0x004000); + } + strip.show(); +}