Hello everyone I’m new here and to programing in general. I recently bought an Alitove led strip with the plan to make stairlighting using my arduino uno.
The plan is to hook up two IR sensors to the top and bottom of the stairs and then depending on which of them is triggered make the leds light up from that direction and after a few seconds turn of in the same direction.
I’m having trouble finding that specific animation and figured I’d ask you guys for support.
You should use for loop to do that. Maybe make 2 functions - other one will be called when sensor detects movement in upstairs and other one from downstairs. For example
for(int i = 0; i < NUMLEDS; i++){
led[i] = CHSV(250,250,250);
FastLED.show();
}
Maybe some delay here…
Then the same loop as above but reversed
Well here is something you could try:
//this will draw leds
for(int i = 0; i < NUM_LEDS; i++){
led[i] = CHSV(250,250,250);
FastLED.show();
}
//this will clear the strip
for(int i = 0; i < NUM_LEDS; i++){
led[i] = CHSV(0,0,0);
FastLED.show();
}
//some delay here is probably wanted, try it yourself
//this will do the same as previous but from other direction
for(int i = NUM_LEDS-1; i => 0; i-){ led[i] = CHSV(250,250,250); FastLED.show(); } for(int i = NUM_LEDS-1; i => 0; i-){
led[i] = CHSV(0,0,0);
FastLED.show();
}
Just add this inside loop() and I think it should work.
You will most likely want to use delays inside for loops but I cannot tell how much you will need