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<FastLED.h> | |
#define REDPIN 3 | |
#define GREENPIN 6 | |
#define BLUEPIN 9 | |
#define NUM_LEDS 1 | |
//#define LED_PIN 12 | |
//#define BRIGHTNESS 255 | |
//#define LED_TYPE WS2812 | |
//#define COLOR_ORDER GRB | |
CRGB leds[NUM_LEDS]; | |
byte max_r = 40; | |
byte min_r = 1; | |
byte bpm_r = 7; | |
byte max_g = 255; | |
byte min_g = 180; | |
byte bpm_g = 8; | |
byte max_b = 40; | |
byte min_b = 1; | |
byte bpm_b = 9; | |
void setup() { | |
pinMode(REDPIN, OUTPUT); | |
pinMode(GREENPIN, OUTPUT); | |
pinMode(BLUEPIN, OUTPUT); | |
//LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS); | |
//LEDS.setBrightness(BRIGHTNESS); | |
} | |
void showAnalogRGB( const CRGB& rgb) | |
{ | |
analogWrite(REDPIN, rgb.r ); | |
analogWrite(GREENPIN, rgb.g ); | |
analogWrite(BLUEPIN, rgb.b ); | |
} | |
void loop() { | |
byte red = beatsin8( bpm_r, min_r, max_r); | |
byte green = beatsin8( bpm_g, min_g, max_g); | |
byte blue = beatsin8( bpm_b, min_b, max_b); | |
leds[0] = CRGB(red, green, blue); | |
showAnalogRGB( leds[0] ); | |
//FastLED.show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment