Created
August 1, 2018 19:59
-
-
Save BarrYPL/ab24a79ef04c8d06da5f4072a05edaf2 to your computer and use it in GitHub Desktop.
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 <Keyboard.h> | |
#include <FastLED.h> | |
#include <Adafruit_NeoPixel.h> | |
#define FASTLED_ALLOW_INTERRUPTS 0 | |
#define NUM_LEDS 26 | |
#define LED_PIN 5 | |
#define LED_TYPE WS2811 | |
#define COLOR_ORDER GRB | |
#define ANALOG_READ 0 | |
CRGB led[NUM_LEDS]; | |
#define BRIGHTNESS 55 | |
#define FRAMES_PER_SECOND 120 | |
int inPin1 = 8; | |
int inPin2 = 9; | |
int val1 = 0; | |
int val2 = 0; | |
int i; | |
void setup() { | |
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(led, NUM_LEDS).setCorrection(TypicalLEDStrip); | |
FastLED.setBrightness(BRIGHTNESS); | |
Serial.begin (28800); | |
pinMode(ledPin1, OUTPUT); | |
pinMode(inPin1, INPUT); | |
pinMode(ledPin2, OUTPUT); | |
pinMode(inPin2, INPUT); | |
Keyboard.begin(); | |
} | |
void AllPink() { | |
for (int i = 0; i < NUM_LEDS; i++) { | |
led[i] = CRGB(155, 0, 155); | |
} | |
FastLED.show(); | |
} | |
void Reset() { | |
for (int i = 0; i < NUM_LEDS; i++) { | |
led[i] = CRGB(0, 0, 0); | |
} | |
FastLED.show(); | |
} | |
void loop() { | |
for (i = 0; i < 256; i++) { | |
val1 = digitalRead(inPin1); | |
if (val1 == HIGH) { | |
//AllPink(); | |
Keyboard.press('z'); | |
} else { | |
digitalWrite(ledPin1, LOW); | |
Keyboard.release('z'); | |
} | |
val2 = digitalRead(inPin2); | |
if (val2 == HIGH) { | |
//AllPink(); | |
Keyboard.press('x'); | |
} else { | |
digitalWrite(ledPin2, LOW); | |
Keyboard.release('x'); | |
} | |
byte changeInHue = 10 / NUM_LEDS; | |
fill_rainbow(led, NUM_LEDS, i, changeInHue); | |
FastLED.show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment