Last active
August 27, 2017 08:04
-
-
Save mnemocron/7b4f7d45a3f05fc82259fdcf9c4c0527 to your computer and use it in GitHub Desktop.
project failed due to hardware issues - code for reference
This file contains 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 <EEPROM.h> | |
#include <TimerOne.h> // timer interrupts | |
#include <OneButton.h> // button library | |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
/* | |
* Pin Declaration | |
* | |
* | | | | | | | |
* .--------------. | |
* | Pro Mini | | |
* | | | |
* | | | |
* | 2 | | |
* | 3 A2 |-- BTN_HIGH | |
* LED_EXT --| 4 A1 |-- BTN_CTR | |
* LED_CTR --| 5 A0 |-- BTN_LOW | |
* LED_ARM_R -| 6 | | |
* LED_ARM_L -| 7 | | |
* LED_LEG_R -| 8 | | |
* LED_LEG_L -| 9 | | |
* '--------------' | |
* | |
* cable colors: | |
* black-black -> 4 | |
* black-grey -> 5 | |
* white-black -> 6 | |
* white-grey -> 7 | |
* blue-black -> 8 | |
* blue-grey -> 9 | |
*/ | |
#define PIN_LED_EXT 4 | |
#define PIN_LED_CTR 5 | |
#define PIN_LED_ARM_R 6 | |
#define PIN_LED_ARM_L 7 | |
#define PIN_LED_LEG_R 8 | |
#define PIN_LED_LEG_L 9 | |
#define PIN_BTN_UP A2 | |
#define PIN_BTN_OK A1 | |
#define PIN_BTN_DN A0 | |
#define MENU_CASES_MAX 5 | |
OneButton buttonUp(PIN_BTN_UP, false); | |
OneButton buttonOk(PIN_BTN_OK, false); | |
OneButton buttonDn(PIN_BTN_DN, false); | |
volatile uint8_t menuSelect = 0; | |
volatile uint8_t brightness = 255; | |
volatile uint8_t needUpdate = 1; | |
volatile uint16_t loop_inner = 0; // globally to use in for loops | |
volatile uint16_t loop_outer = 0; | |
volatile uint16_t loop_control = 0; | |
// Pattern types supported: | |
enum pattern { FUCKOFF, TAIL_LIGHTS, WHITE_LIGHTS, COLOR_TWINKLE, RAINBOW_CYCLE, RAINBOW_FADE }; | |
// Physical attachment locations of the leds: | |
enum location { CENTER, EXT, LEG_R, LEG_L, ARM_R, ARM_L }; | |
// NeoPattern Class - derived from the Adafruit_NeoPixel class | |
class NeoPatterns : public Adafruit_NeoPixel | |
{ | |
private: | |
location attatchedTo; | |
public: | |
pattern ActivePattern; // which pattern is running | |
unsigned long Interval; // milliseconds between updates | |
unsigned long lastUpdate; // last update of position | |
uint32_t Color1, Color2; // What colors are in use | |
uint16_t TotalSteps; // total number of steps in the pattern | |
uint16_t Index; // current step within the pattern | |
uint8_t brightnessSetting = 255; | |
// Constructor - calls base-class constructor to initialize strip | |
NeoPatterns(uint16_t pixels, uint8_t pin, uint8_t type, location loc) | |
:Adafruit_NeoPixel(pixels, pin, type){ | |
this->attatchedTo = loc; | |
} | |
void Update(){ | |
lastUpdate = millis(); | |
switch (ActivePattern) | |
{ | |
case FUCKOFF: | |
FuckoffUpdate(); | |
break; | |
case TAIL_LIGHTS: | |
TailLightsUpdate(); | |
break; | |
case WHITE_LIGHTS: | |
WhiteLightsUpdate(); | |
break; | |
case COLOR_TWINKLE: | |
ColorTwinkleUpdate(); | |
break; | |
case RAINBOW_CYCLE: | |
RainbowCycleUpdate(); | |
break; | |
case RAINBOW_FADE: | |
RainbowFadeUpdate(); | |
break; | |
default: | |
ActivePattern = FUCKOFF; | |
break; | |
} | |
} | |
void Increment(){ | |
Index++; | |
if (Index >= TotalSteps){ | |
Index = 0; | |
} | |
} | |
void Fuckoff(){ | |
ActivePattern = FUCKOFF; | |
Interval = 1000; // static image, update only every second | |
TotalSteps = 1; | |
Index = 0; | |
FuckoffUpdate(); | |
} | |
void FuckoffUpdate(){ | |
clear(); | |
showTrue(); | |
Increment(); | |
} | |
void TailLights(){ | |
ActivePattern = TAIL_LIGHTS; | |
Interval = 1000; // static image, update only every second | |
TotalSteps = 1; | |
Index = 0; | |
TailLightsUpdate(); | |
} | |
void TailLightsUpdate(){ | |
clear(); | |
switch (attatchedTo){ | |
case CENTER: | |
case EXT: | |
for(uint8_t i=0; i<8; i++){ | |
setPixelColor(i, 0x00ff0000); | |
} | |
setPixelColor(8, 0xff000000); | |
setPixelColor(9, 0xff000000); | |
setPixelColor(14, 0xff000000); | |
setPixelColor(15, 0xff000000); | |
break; | |
case ARM_R: | |
case ARM_L: | |
for(uint8_t i=4; i<8; i++){ | |
setPixelColor(i, 0x00ff0000); | |
} | |
break; | |
case LEG_R: | |
case LEG_L: | |
for(uint8_t i=2; i<6; i++){ | |
setPixelColor(i, 0xff000000); | |
} | |
setPixelColor(0, 0x00502000); | |
setPixelColor(7, 0x00502000); | |
for(uint8_t i=8; i<16; i++){ | |
setPixelColor(i, 0x00ff0000); | |
} | |
default: | |
break; | |
} | |
showTrue(); | |
Increment(); | |
} | |
void WhiteLights(){ | |
ActivePattern = WHITE_LIGHTS; | |
Interval = 1000; // static image, update only every second | |
TotalSteps = 1; | |
Index = 0; | |
WhiteLightsUpdate(); | |
} | |
void WhiteLightsUpdate(){ | |
clear(); | |
switch (attatchedTo){ | |
case CENTER: | |
case EXT: | |
for(uint8_t i=0; i<8; i++){ | |
setPixelColor(i, 0x0000ff00); | |
} | |
setPixelColor(8, 0x0000ff00); | |
setPixelColor(9, 0x0000ff00); | |
setPixelColor(14, 0x0000ff00); | |
setPixelColor(15, 0x0000ff00); | |
break; | |
case ARM_R: | |
case ARM_L: | |
for(uint8_t i=4; i<8; i++){ | |
setPixelColor(i, 0x0000ff00); | |
} | |
break; | |
case LEG_R: | |
case LEG_L: | |
for(uint8_t i=2; i<6; i++){ | |
setPixelColor(i, 0x0000ff00); | |
} | |
setPixelColor(0, 0x00502000); | |
setPixelColor(7, 0x00502000); | |
for(uint8_t i=8; i<16; i++){ | |
setPixelColor(i, 0x0000ff00); | |
} | |
default: | |
break; | |
} | |
showTrue(); | |
Increment(); | |
} | |
void RainbowCycle(uint8_t interval){ | |
ActivePattern = RAINBOW_CYCLE; | |
Interval = interval; | |
TotalSteps = 255; | |
Index = 0; | |
} | |
void RainbowCycleUpdate(){ | |
for(uint8_t i=0; i<numPixels(); i++){ | |
setPixelColor(i, Wheel(((i * 256 / numPixels()) + Index) & 255)); | |
} | |
showTrue(); | |
Increment(); | |
} | |
void RainbowFadeUpdate(){ | |
} | |
void ColorTwinkleUpdate(){ | |
} | |
// Set all pixels in a strip to a color | |
void ColorSet(uint32_t color){ | |
for (uint8_t i=0; i<numPixels(); i++){ | |
setPixelColor(i, color); | |
} | |
showTrue(); | |
} | |
// Input a value 0 to 255 to get a color value. | |
// The colours are a transition r - g - b - back to r. | |
uint32_t Wheel(byte WheelPos) | |
{ | |
WheelPos = 255 - WheelPos; | |
if (WheelPos < 85){ | |
return Color(255 - WheelPos * 3, 0, WheelPos * 3); | |
} else if (WheelPos < 170){ | |
WheelPos -= 85; | |
return Color(0, WheelPos * 3, 255 - WheelPos * 3); | |
} else { | |
WheelPos -= 170; | |
return Color(WheelPos * 3, 255 - WheelPos * 3, 0); | |
} | |
} | |
void showTrue(){ | |
setBrightness(brightnessSetting); | |
show(); | |
} | |
}; | |
/* | |
* LED Initialisation | |
*/ | |
#define NUM_LEDS 16 | |
NeoPatterns ledExt = NeoPatterns(NUM_LEDS, PIN_LED_EXT, NEO_GRBW + NEO_KHZ800, EXT ); | |
NeoPatterns ledCtr = NeoPatterns(NUM_LEDS, PIN_LED_CTR, NEO_GRBW + NEO_KHZ800, CENTER); | |
NeoPatterns ledArmR = NeoPatterns(NUM_LEDS, PIN_LED_ARM_R, NEO_GRBW + NEO_KHZ800, ARM_R ); | |
NeoPatterns ledArmL = NeoPatterns(NUM_LEDS, PIN_LED_ARM_L, NEO_GRBW + NEO_KHZ800, ARM_L ); | |
NeoPatterns ledLegR = NeoPatterns(NUM_LEDS, PIN_LED_LEG_R, NEO_GRBW + NEO_KHZ800, LEG_R ); | |
NeoPatterns ledLegL = NeoPatterns(NUM_LEDS, PIN_LED_LEG_L, NEO_GRBW + NEO_KHZ800, LEG_L ); | |
void setup(){ | |
ledExt.begin(); | |
ledCtr.begin(); | |
ledArmR.begin(); | |
ledArmL.begin(); | |
ledLegR.begin(); | |
ledLegL.begin(); | |
ledExt.show(); | |
ledCtr.show(); | |
ledArmR.show(); | |
ledArmL.show(); | |
ledLegR.show(); | |
ledLegL.show(); | |
pinMode(PIN_BTN_UP, INPUT); | |
pinMode(PIN_LED_CTR, INPUT); | |
pinMode(PIN_BTN_DN, INPUT); | |
Timer1.initialize(20000); // 10ms button | |
Timer1.attachInterrupt(pollButtons); | |
buttonUp.attachClick(brightnessUp); | |
buttonDn.attachClick(brightnessDn); | |
buttonOk.attachClick(scrollMenu); | |
Serial.begin(9600); | |
Serial.println("debug"); | |
} | |
void loop(){ | |
if(needUpdate){ | |
ledExt.brightnessSetting = brightness; | |
ledCtr.brightnessSetting = brightness; | |
ledArmR.brightnessSetting = brightness; | |
ledArmL.brightnessSetting = brightness; | |
ledLegR.brightnessSetting = brightness; | |
ledLegL.brightnessSetting = brightness; | |
needUpdate = 0; | |
switch( menuSelect ){ | |
// animations here: | |
case 0: | |
Serial.println("Fuckoff"); | |
ledExt.Fuckoff(); | |
ledCtr.Fuckoff(); | |
ledArmR.Fuckoff(); | |
ledArmL.Fuckoff(); | |
ledLegR.Fuckoff(); | |
ledLegL.Fuckoff(); | |
break; | |
case 1: | |
Serial.println("RainbowCycle"); | |
ledExt.RainbowCycle(3); | |
ledCtr.RainbowCycle(3); | |
ledArmR.RainbowCycle(3); | |
ledArmL.RainbowCycle(3); | |
ledLegR.RainbowCycle(3); | |
ledLegL.RainbowCycle(3); | |
break; | |
case 2: | |
Serial.println("TailLights"); | |
ledExt.TailLights(); | |
ledCtr.TailLights(); | |
ledArmR.TailLights(); | |
ledArmL.TailLights(); | |
ledLegR.TailLights(); | |
ledLegL.TailLights(); | |
break; | |
case 3: | |
Serial.println("WhiteLights"); | |
ledExt.WhiteLights(); | |
ledCtr.WhiteLights(); | |
ledArmR.WhiteLights(); | |
ledArmL.WhiteLights(); | |
ledLegR.WhiteLights(); | |
ledLegL.WhiteLights(); | |
break; | |
default : | |
menuSelect = 0; | |
needUpdate = 1; | |
} | |
} | |
ledCtr.Update(); | |
ledExt.Update(); | |
ledArmR.Update(); | |
ledArmL.Update(); | |
ledLegR.Update(); | |
ledLegL.Update(); | |
} | |
void brightnessUp(){ | |
brightness == 255 ? brightness = 255 : brightness += 45; | |
needUpdate = 1; | |
} | |
void brightnessDn(){ | |
brightness == 30 ? brightness = 30 : brightness -= 45; | |
needUpdate = 1; | |
} | |
void scrollMenu(){ | |
menuSelect == MENU_CASES_MAX ? menuSelect = 0 : menuSelect ++; | |
needUpdate = 1; | |
loop_control = 0; | |
} | |
void pollButtons(){ | |
buttonUp.tick(); | |
buttonOk.tick(); | |
buttonDn.tick(); | |
} | |
void updateLeds(uint8_t bright){ | |
ledExt.setBrightness(bright); | |
ledCtr.setBrightness(bright); | |
ledArmR.setBrightness(bright); | |
ledArmL.setBrightness(bright); | |
ledLegR.setBrightness(bright); | |
ledLegL.setBrightness(bright); | |
ledExt.show(); | |
ledCtr.show(); | |
ledArmR.show(); | |
ledArmL.show(); | |
ledLegR.show(); | |
ledLegL.show(); | |
} |
This file contains 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 <EEPROM.h> | |
#include <TimerOne.h> // timer interrupts | |
#include <OneButton.h> // button library | |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
/* | |
* Pin Declaration | |
* | |
* | | | | | | | |
* .--------------. | |
* | Pro Mini | | |
* | | | |
* | | | |
* | 2 | | |
* | 3 A2 |-- BTN_HIGH | |
* LED_EXT --| 4 A1 |-- BTN_CTR | |
* LED_CTR --| 5 A0 |-- BTN_LOW | |
* LED_ARM_R -| 6 | | |
* LED_ARM_L -| 7 | | |
* LED_LEG_R -| 8 | | |
* LED_LEG_L -| 9 | | |
* '--------------' | |
* | |
* cable colors: | |
* black-black -> 4 | |
* black-grey -> 5 | |
* white-black -> 6 | |
* white-grey -> 7 | |
* blue-black -> 8 | |
* blue-grey -> 9 | |
*/ | |
#define PIN_LED_EXT 4 | |
#define PIN_LED_CTR 5 | |
#define PIN_LED_ARM_R 6 | |
#define PIN_LED_ARM_L 7 | |
#define PIN_LED_LEG_R 8 | |
#define PIN_LED_LEG_L 9 | |
#define PIN_BTN_UP A2 | |
#define PIN_BTN_OK A1 | |
#define PIN_BTN_DN A0 | |
#define MENU_CASES_MAX 5 | |
/* | |
* LED Initialisation | |
*/ | |
#define NUM_LEDS 16 | |
Adafruit_NeoPixel ledExt = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_EXT, NEO_GRBW + NEO_KHZ800); | |
Adafruit_NeoPixel ledCtr = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_CTR, NEO_GRBW + NEO_KHZ800); | |
Adafruit_NeoPixel ledArmR = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_ARM_R, NEO_GRBW + NEO_KHZ800); | |
Adafruit_NeoPixel ledArmL = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_ARM_L, NEO_GRBW + NEO_KHZ800); | |
Adafruit_NeoPixel ledLegR = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_LEG_R, NEO_GRBW + NEO_KHZ800); | |
Adafruit_NeoPixel ledLegL = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_LEG_L, NEO_GRBW + NEO_KHZ800); | |
OneButton buttonUp(PIN_BTN_UP, false); | |
OneButton buttonOk(PIN_BTN_OK, false); | |
OneButton buttonDn(PIN_BTN_DN, false); | |
volatile uint8_t menuSelect = 0; | |
volatile uint8_t brightness = 255; | |
volatile uint8_t needUpdate = 1; | |
volatile uint16_t loop_inner = 0; // globally to use in for loops | |
volatile uint16_t loop_outer = 0; | |
volatile uint16_t loop_control = 0; | |
// Color Scheme Twinkle | |
#define COLOR_PRESET 0x00200002 | |
#define COLOR_GLOW 0x20F05000 | |
volatile uint8_t rStates[8]; | |
volatile uint8_t bStates[8]; | |
volatile uint8_t gStates[8]; | |
volatile uint8_t wStates[8]; | |
float fadeRate = 0.03; | |
volatile uint8_t wPreset = ((COLOR_GLOW >> 24)&0xff); | |
volatile uint8_t rPreset = ((COLOR_GLOW >> 16)&0xff); | |
volatile uint8_t gPreset = ((COLOR_GLOW >> 8)&0xff); | |
volatile uint8_t bPreset = ((COLOR_GLOW )&0xff); | |
volatile uint8_t wGlow = ((COLOR_PRESET >> 24)&0xff); | |
volatile uint8_t rGlow = ((COLOR_PRESET >> 16)&0xff); | |
volatile uint8_t gGlow = ((COLOR_PRESET >> 8)&0xff); | |
volatile uint8_t bGlow = ((COLOR_PRESET )&0xff); | |
void setup(){ | |
ledExt.begin(); | |
ledCtr.begin(); | |
ledArmR.begin(); | |
ledArmL.begin(); | |
ledLegR.begin(); | |
ledLegL.begin(); | |
ledExt.show(); | |
ledCtr.show(); | |
ledArmR.show(); | |
ledArmL.show(); | |
ledLegR.show(); | |
ledLegL.show(); | |
pinMode(PIN_BTN_UP, INPUT); | |
pinMode(PIN_LED_CTR, INPUT); | |
pinMode(PIN_BTN_DN, INPUT); | |
Timer1.initialize(10000); // 10ms button | |
Timer1.attachInterrupt(pollButtons); | |
buttonUp.attachClick(brightnessUp); | |
buttonDn.attachClick(brightnessDn); | |
buttonOk.attachClick(scrollMenu); | |
Serial.begin(9600); | |
Serial.println("debug"); | |
} | |
void loop(){ | |
if(needUpdate){ | |
needUpdate = 0; | |
switch( menuSelect ){ | |
// animations here: | |
case 0: | |
colorSchemeReset(); | |
updateLeds(brightness); | |
break; | |
case 1: | |
// Serial.println("white"); | |
colorSchemeReset(); | |
for(int i=0; i<16; i++) ledExt.setPixelColor(i, 0xff000000); | |
for(int i=0; i<16; i++) ledCtr.setPixelColor(i, 0xff000000); | |
for(int i=0; i<16; i++) ledLegR.setPixelColor(i, 0xff000000); | |
for(int i=0; i<16; i++) ledLegL.setPixelColor(i, 0xff000000); | |
updateLeds(brightness); | |
break; | |
case 2: | |
// Serial.println("headlights"); | |
colorSchemeHeadlights(); | |
updateLeds(brightness); | |
break; | |
case 3: | |
// Serial.println("green"); | |
colorSchemeReset(); | |
for(int i=0; i<16; i++) ledExt.setPixelColor(i, 0x0000ff00); | |
updateLeds(brightness); | |
break; | |
case 4: | |
// Serial.println("RAINBOW"); | |
if(!loop_control){ | |
loop_control = 1; | |
loop_outer = 0; | |
} | |
colorSchemeSetAll(Wheel(loop_outer)); | |
updateLeds(brightness); | |
loop_outer = (loop_outer + 1) % 0xff; | |
// Serial.println(loop_outer); | |
delay(20); | |
needUpdate = 1; | |
break; | |
default : | |
menuSelect = 0; | |
} | |
} | |
} | |
void brightnessUp(){ | |
brightness == 255 ? brightness = 255 : brightness += 45; | |
needUpdate = 1; | |
} | |
void brightnessDn(){ | |
brightness == 30 ? brightness = 30 : brightness -= 45; | |
needUpdate = 1; | |
} | |
void scrollMenu(){ | |
menuSelect == MENU_CASES_MAX ? menuSelect = 0 : menuSelect ++; | |
needUpdate = 1; | |
loop_control = 0; | |
} | |
void pollButtons(){ | |
buttonUp.tick(); | |
buttonOk.tick(); | |
buttonDn.tick(); | |
} | |
void updateLeds(uint8_t bright){ | |
ledExt.setBrightness(bright); | |
ledCtr.setBrightness(bright); | |
ledArmR.setBrightness(bright); | |
ledArmL.setBrightness(bright); | |
ledLegR.setBrightness(bright); | |
ledLegL.setBrightness(bright); | |
ledExt.show(); | |
ledCtr.show(); | |
ledArmR.show(); | |
ledArmL.show(); | |
ledLegR.show(); | |
ledLegL.show(); | |
} | |
// Input a value 0 to 255 to get a color value. | |
// The colours are a transition r - g - b - back to r. | |
uint32_t Wheel(byte WheelPos) { | |
WheelPos = 255 - WheelPos; | |
if(WheelPos < 85) { | |
return ledExt.Color(255 - WheelPos * 3, 0, WheelPos * 3,0); | |
} | |
if(WheelPos < 170) { | |
WheelPos -= 85; | |
return ledExt.Color(0, WheelPos * 3, 255 - WheelPos * 3,0); | |
} | |
WheelPos -= 170; | |
return ledExt.Color(WheelPos * 3, 255 - WheelPos * 3, 0,0); | |
} | |
/* | |
* Color Schemes | |
* | |
* ledLegX | |
* ---> [x][x][x][x][x][x][x][x] ---> [x][x][x][x][x][x][x][x] | |
* | |
* LedArmX | |
* ---> [x][x][x][x][x][x][x][x] | |
* | |
* LedCenter | |
* ---> [x][x][x][x][x][x][x][x] ---> [x][x][x][x][x][x][x][x] | |
* | |
* LedExternal | |
* ---> [x][x][x][x][x][x][x][x] | |
* | |
*/ | |
/* | |
void colorSchemeFadeOn(int ddel){ | |
for(uint8_t i=0; i<=255; i++){ | |
updateLeds(); | |
} | |
} | |
*/ | |
void colorSchemeReset(){ | |
ledExt.clear(); | |
ledCtr.clear(); | |
ledArmR.clear(); | |
ledArmL.clear(); | |
ledLegR.clear(); | |
ledLegL.clear(); | |
} | |
void colorSchemeSetAll(uint32_t ccol){ | |
for(int i=0; i<NUM_LEDS; i++) ledExt.setPixelColor(i, ccol); | |
for(int i=0; i<NUM_LEDS; i++) ledCtr.setPixelColor(i, ccol); | |
for(int i=0; i<NUM_LEDS; i++) ledArmR.setPixelColor(i, ccol); | |
for(int i=0; i<NUM_LEDS; i++) ledArmL.setPixelColor(i, ccol); | |
for(int i=0; i<NUM_LEDS; i++) ledLegR.setPixelColor(i, ccol); | |
for(int i=0; i<NUM_LEDS; i++) ledLegL.setPixelColor(i, ccol); | |
} | |
void colorSchemeSetBar(uint8_t n, uint32_t ccol){ | |
ledExt.setPixelColor(n, ccol); | |
ledExt.setPixelColor(n+8, ccol); | |
ledCtr.setPixelColor(n, ccol); | |
ledCtr.setPixelColor(n+8, ccol); | |
ledArmR.setPixelColor(n, ccol); | |
ledArmR.setPixelColor(n+8, ccol); | |
ledArmL.setPixelColor(n, ccol); | |
ledArmL.setPixelColor(n+8, ccol); | |
ledLegR.setPixelColor(n, ccol); | |
ledLegR.setPixelColor(n+8, ccol); | |
ledLegL.setPixelColor(n, ccol); | |
ledLegL.setPixelColor(n+8, ccol); | |
} | |
/* | |
* Color Scheme Head Lights | |
* | |
* ledLegX | |
* ---> [W][W][.][.][.][.][W][W] ---> [R][R][R][R][R][R][.][.] | |
* | |
* LedArmX | |
* ---> [R][R][R][R][R][R][.][.] | |
* | |
* LedCenter | |
* ---> [R][R][.][.][.][.][R][R] ---> [.][.][W][W][W][W][.][.] | |
* | |
* LedExternal | |
* ---> [R][R][R][R][R][R][R][R] | |
* | |
*/ | |
void colorSchemeHeadlights(){ | |
colorSchemeReset(); | |
// legs | |
ledLegR.setPixelColor( 0, 0xff000000); | |
ledLegR.setPixelColor( 1, 0xff000000); | |
ledLegR.setPixelColor( 6, 0xff000000); | |
ledLegR.setPixelColor( 7, 0xff000000); | |
ledLegR.setPixelColor( 8, 0x00ff0000); | |
ledLegR.setPixelColor( 9, 0x00ff0000); | |
ledLegR.setPixelColor(10, 0x00ff0000); | |
ledLegR.setPixelColor(11, 0x00ff0000); | |
ledLegR.setPixelColor(12, 0x00ff0000); | |
ledLegR.setPixelColor(13, 0x00ff0000); | |
ledLegL.setPixelColor( 0, 0xff000000); | |
ledLegL.setPixelColor( 1, 0xff000000); | |
ledLegL.setPixelColor( 6, 0xff000000); | |
ledLegL.setPixelColor( 7, 0xff000000); | |
ledLegL.setPixelColor( 8, 0x00ff0000); | |
ledLegL.setPixelColor( 9, 0x00ff0000); | |
ledLegL.setPixelColor(10, 0x00ff0000); | |
ledLegL.setPixelColor(11, 0x00ff0000); | |
ledLegL.setPixelColor(12, 0x00ff0000); | |
ledLegL.setPixelColor(13, 0x00ff0000); | |
// arms | |
ledArmR.setPixelColor( 8, 0x00ff0000); | |
ledArmR.setPixelColor( 9, 0x00ff0000); | |
ledArmR.setPixelColor(10, 0x00ff0000); | |
ledArmR.setPixelColor(11, 0x00ff0000); | |
ledArmR.setPixelColor(12, 0x00ff0000); | |
ledArmR.setPixelColor(13, 0x00ff0000); | |
ledArmL.setPixelColor( 8, 0x00ff0000); | |
ledArmL.setPixelColor( 9, 0x00ff0000); | |
ledArmL.setPixelColor(10, 0x00ff0000); | |
ledArmL.setPixelColor(11, 0x00ff0000); | |
ledArmL.setPixelColor(12, 0x00ff0000); | |
ledArmL.setPixelColor(13, 0x00ff0000); | |
// center | |
ledCtr.setPixelColor( 0, 0x00ff0000); | |
ledCtr.setPixelColor( 1, 0x00ff0000); | |
ledCtr.setPixelColor( 6, 0x00ff0000); | |
ledCtr.setPixelColor( 7, 0x00ff0000); | |
ledCtr.setPixelColor(10, 0xff000000); | |
ledCtr.setPixelColor(11, 0xff000000); | |
ledCtr.setPixelColor(12, 0xff000000); | |
ledCtr.setPixelColor(13, 0xff000000); | |
// external | |
for(int i=0; i<8; i++) ledExt.setPixelColor(i, 0x00ff0000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment