fastled-basics's People
Forkers
orb1t lolkoarmy matthias-gass gilaz stollstoll sparetm raghavendrashekhawat2 icewhitecube naorsa198 dannysprogis sabrinatt7 ksaliya i-support-it joshsticko captweiss viveky1794 azuanrosdi peterdezso andynewlands matititam hal-9000a 818rizzo gugukatze raychenz raghavnagpal eclisia lizyliposomize addung97 simonboudreault mcasademont9 iekiko89 ryan-arends jpipe001 edistechlab pratyaksh14 ruecktenwald 129xiaoxiao arsalanchang ljingee theglasscannon loknathd4 tommelchin suresh16eee47 guxfei russelltsherman galaxy-man courtnay23 denizcanturk xwlgloryxx smj2mm codingsilifestyle mybigmanfastled-basics's Issues
Button and timer mixed
#include <FastLED.h>
#include <OneButton.h>
#define NUM_LEDS 10
#define LED_PIN 7
#define BTN_PIN 6
CRGB leds[NUM_LEDS];
uint8_t patternCounter = 0;
// Push button connected between pin 7 and GND (no resistor required)
OneButton btn = OneButton(BTN_PIN, true, true);
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(255);
Serial.begin(57600);
btn.attachClick(nextPattern);
}
void loop() {
switch (patternCounter) {
case 0:
movingDots();
break;
case 1:
rainbowBeat();
break;
case 2:
redWhiteBlue();
break;
}
EVERY_N_SECONDS(10)
{
nextPattern();
}
FastLED.show();
btn.tick();
}
void nextPattern() {
patternCounter = (patternCounter + 1) % 3; // Change the number after the % to the number of patterns you have
}
//------- Put your patterns below -------//
void movingDots() {
uint16_t posBeat = beatsin16(30, 0, NUM_LEDS - 1, 0, 0);
uint16_t posBeat2 = beatsin16(60, 0, NUM_LEDS - 1, 0, 0);
uint16_t posBeat3 = beatsin16(30, 0, NUM_LEDS - 1, 0, 32767);
uint16_t posBeat4 = beatsin16(60, 0, NUM_LEDS - 1, 0, 32767);
// Wave for LED color
uint8_t colBeat = beatsin8(45, 0, 255, 0, 0);
leds[(posBeat + posBeat2) / 2] = CHSV(colBeat, 255, 255);
leds[(posBeat3 + posBeat4) / 2] = CHSV(colBeat, 255, 255);
fadeToBlackBy(leds, NUM_LEDS, 10);
}
void rainbowBeat() {
uint16_t beatA = beatsin16(30, 0, 255);
uint16_t beatB = beatsin16(20, 0, 255);
fill_rainbow(leds, NUM_LEDS, (beatA + beatB) / 2, 8);
}
void redWhiteBlue() {
uint16_t sinBeat = beatsin16(30, 0, NUM_LEDS - 1, 0, 0);
uint16_t sinBeat2 = beatsin16(30, 0, NUM_LEDS - 1, 0, 21845);
uint16_t sinBeat3 = beatsin16(30, 0, NUM_LEDS - 1, 0, 43690);
leds[sinBeat] = CRGB::Blue;
leds[sinBeat2] = CRGB::Red;
leds[sinBeat3] = CRGB::White;
fadeToBlackBy(leds, NUM_LEDS, 10);
}
This is code for mixing timing change and button press. Change the time or add a physical 2 state switch for checking on-off.
Sorry, I don't know how to use git.
Free FastLED simulator ๐
Hello There
Good day
I have compiled a collection of FastLED simulations (all based on your examples provided)
I would like to request you to add the wokwi simulator link to your readme page if you find this simulator helpful for your viewers.
if you have any suggestions or feedback, please feel free to suggest.
Thanks in Advance!
https://wokwi.com/arduino/projects/287903705030722060
https://wokwi.com/arduino/projects/287938818561016332
https://wokwi.com/arduino/projects/287939551461114380
https://wokwi.com/arduino/projects/287940145420698120
https://wokwi.com/arduino/projects/288329771683676685
https://wokwi.com/arduino/projects/288331607751787020
https://wokwi.com/arduino/projects/288332130035958280
Regards
Matititam
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.