FastLED 3.10.6
Loading...
Searching...
No Matches
AnalogOutput.ino
// @filter: (board is not atmega8*)
#include <Arduino.h>
#include <FastLED.h>
// Example showing how to use FastLED color functions
// even when you're NOT using a "pixel-addressible" smart LED strip.
//
// This example is designed to control an "analog" RGB LED strip
// (or a single RGB LED) being driven by Arduino PWM output pins.
// FastLED's ANALOG_RGB controller applies brightness, color correction, and
// color temperature before writing PWM duty cycles to the three output pins.
//
// In this example, the RGB values are output on three separate
// 'analog' PWM pins, one for red, one for green, and one for blue.
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3
// Set the single analog RGB output color and update its PWM pins.
void showAnalogRGB( const CRGB& rgb)
{
leds[0] = rgb;
FastLED.show();
}
// colorBars: flashes Red, then Green, then Blue, then Black.
// Helpful for diagnosing if you've mis-wired which is which.
void colorBars()
{
showAnalogRGB( CRGB::Red ); delay(500);
showAnalogRGB( CRGB::Green ); delay(500);
showAnalogRGB( CRGB::Blue ); delay(500);
showAnalogRGB( CRGB::Black ); delay(500);
}
void loop()
{
static uint8_t hue;
hue = hue + 1;
// Use FastLED automatic HSV->RGB conversion
showAnalogRGB( CHSV( hue, 255, 255) );
delay(20);
}
void setup() {
.setCorrection(TypicalLEDStrip)
.setTemperature(DirectSunlight);
FastLED.setBrightness(192);
// Flash the "hello" color sequence: R, G, B, black.
}
CRGB leds[1]
void colorBars()
void showAnalogRGB(const CRGB &rgb)
void setup()
#define REDPIN
#define GREENPIN
#define BLUEPIN
void loop()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
uint8_t hue
Definition advanced.h:94
FastLED chipset-style wrapper for three-pin PWM RGB output.
Definition analog.h:56
@ DirectSunlight
6000 Kelvin
Definition color.h:58
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:15
fl::hsv8 CHSV
Definition chsv.h:11
fl::CRGB CRGB
Definition crgb.h:25
void delay(u32 ms, bool run_async=true) FL_NO_EXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
unsigned char uint8_t
Definition stdint.h:208
@ Green
<div style='background:#008000;width:4em;height:4em;'></div>
Definition crgb.h:565
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:629
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:519
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517