Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Things to do:
- 5 different inputs = 5 different outputs
- Figure out LED arrays, incorperate
- comment ALL THE CODE!!!!!!!!!!!!!!!!!!
- Make it fancy*/
- #include <TimerOne.h>
- #include <FastLED.h>
- #define NUM_LEDS 75
- #define LED_PIN 3
- #define BRIGHTNESS 75
- #define LED_TYPE NEOPIXEL
- #define COLOR_ORDER GRB
- #define UPDATES_PER_SECOND 2098
- CRGB leds[NUM_LEDS];
- const int pin5 = 5;
- const int pin6 = 6;
- const int pin7 = 7;
- const int pin8 = 8;
- const int pin9 = 9;
- void setup() {
- delay(3000);
- FastLED.addLeds<LED_TYPE, LED_PIN>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- pinMode(pin5, INPUT_PULLUP);
- pinMode(pin6, INPUT_PULLUP);
- pinMode(pin7, INPUT_PULLUP);
- pinMode(pin8, INPUT_PULLUP);
- pinMode(pin9, INPUT_PULLUP);
- }
- int getMode(int d5, int d6, int d7) {
- int rtn = 1;
- if (d7 == 1 && d6 == 1 && d5 == 0) {
- rtn = 0;
- }
- if (d7 == 1 && d6 == 1 && d5 == 1) {
- rtn = 1;
- }
- return rtn;
- }
- void loop() {
- int d5 = digitalRead(pin5);
- int d6 = digitalRead(pin6);
- int d7 = digitalRead(pin7);
- int mode = getMode(d5, d6, d7);
- switch (mode)
- {
- case 0:
- leds[0] = CRGB::Green;
- leds[1] = CRGB::Green;
- leds[2] = CRGB::Green;
- leds[3] = CRGB::Green;
- leds[4] = CRGB::Green;
- leds[5] = CRGB::Green;
- leds[6] = CRGB::Green;
- leds[7] = CRGB::Green;
- //leds[8] = CRGB::Green;
- FastLED.show();
- //delay(50);
- break;
- case 1:
- leds[0] = CRGB::Red;
- leds[1] = CRGB::Red;
- leds[2] = CRGB::Red;
- leds[3] = CRGB::Red;
- leds[4] = CRGB::Red;
- leds[5] = CRGB::Red;
- leds[6] = CRGB::Red;
- leds[7] = CRGB::Red;
- //leds[8] = CRGB::Red;
- FastLED.show();
- //delay(50);
- break;
- /*case 6:
- leds[0] = CRGB::Green;
- FastLED.show();
- //delay(500);
- break;
- default:
- leds[0] = CRGB::Black;
- //FastLED.show();
- //delay(500);
- //break; */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment