Created
June 20, 2015 21:04
-
-
Save gelicia/dd566007aa620accb774 to your computer and use it in GitHub Desktop.
signlr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_NeoPixel.h> | |
#define LLEDPIN 10 | |
#define LBUTTONPIN 4 | |
#define RLEDPIN 7 | |
#define RBUTTONIN 6 | |
int leftButtonState = 0; | |
int rightButtonState = 0; | |
const int ledPin = 13; | |
Adafruit_NeoPixel l_arrow = Adafruit_NeoPixel(3, LLEDPIN, NEO_GRB + NEO_KHZ800); | |
Adafruit_NeoPixel r_arrow = Adafruit_NeoPixel(3, RLEDPIN, NEO_GRB + NEO_KHZ800); | |
void setup() { | |
pinMode(LBUTTONPIN, INPUT); | |
pinMode(RBUTTONIN, INPUT); | |
pinMode(ledPin, OUTPUT); | |
pinMode(LLEDPIN, OUTPUT); | |
pinMode(RLEDPIN, OUTPUT); | |
} | |
void loop() { | |
/*for(uint16_t i=0; i<l_arrow.numPixels(); i++) { | |
l_arrow.setPixelColor(i, l_arrow.Color(255,0,0)); | |
} | |
l_arrow.show();*/ | |
leftButtonState = digitalRead(LBUTTONPIN); | |
rightButtonState = digitalRead(RBUTTONIN); | |
if (leftButtonState == HIGH) { | |
digitalWrite(ledPin, HIGH); | |
for(uint16_t i=0; i<l_arrow.numPixels(); i++) { | |
l_arrow.setPixelColor(i, l_arrow.Color(255,0,0)); | |
} | |
l_arrow.show(); | |
} | |
else { | |
digitalWrite(ledPin, LOW); | |
for(uint16_t i=0; i<l_arrow.numPixels(); i++) { | |
l_arrow.setPixelColor(i, l_arrow.Color(0,0,0)); | |
} | |
l_arrow.show(); | |
} | |
/* if (rightButtonState == HIGH) { | |
digitalWrite(ledPin, HIGH); | |
for(uint16_t i=0; i<r_arrow.numPixels(); i++) { | |
r_arrow.setPixelColor(i, r_arrow.Color(255,0,0)); | |
} | |
r_arrow.show(); | |
} | |
else { | |
digitalWrite(ledPin, LOW); | |
for(uint16_t i=0; i<r_arrow.numPixels(); i++) { | |
r_arrow.setPixelColor(i, r_arrow.Color(0,0,0)); | |
} | |
r_arrow.show(); | |
}*/ | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment