Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int LEDmode = 0;
- String LED = "";
- void setup()
- {
- strip.begin();
- strip.show();
- Wire.begin(4);
- Wire.onReceive(dataReceived);
- }
- void loop()
- {
- RunLEDs(LEDmode);
- }
- void dataReceived(int howMany)
- {
- LED = "";
- while ( Wire.available() > 0 ){
- char n=(char)Wire.read();
- if(((int)n)>((int)(' ')))
- LED += n;
- }
- if(LED == "DISABLED"){
- LEDmode = 0;
- }else if(LED == "AUTO"){
- LEDmode= 1;
- }else if(LED == "TELEOP"){
- LEDmode = 2;
- }else{
- LEDmode = 0;
- }
- }
- void RunLEDs(int mode)
- {
- if(LED == "DISABLED"){
- chaseColor(255, 255, 255, 10);
- }else if(LED == "AUTO"){
- fadeRed(10);
- }else if(LED == "TELEOP"){
- fadeRed(10);
- }else{
- chaseColor(255, 255, 255, 10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement