Hello everyone I'm new here and to programing in general.

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.

Thanks in advance!

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

I can make a more detailed answer when I get home if you need more help. Typing on phone is a bit slow :smiley:

@Reko_Merio Hey thank you for helping, I’d be really greatful if you could find the time to help me further :smiley:

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

@Reko_Merio I tried that and it showed two errors:

error: expected primary-expression before ‘)’ token

for(int i = NUM_LEDS-1; i => 0; i-){

and

error: expected primary-expression before ‘>’ token

for(int i = NUM_LEDS-1; i => 0; i-){

If you want I can paste the whole code. Maybe that makes it a bit easier :smiley:

Sorry, there is a small typo on the last two loops.
It should be like this:
for(int i = NUM_LEDS-1; i >= 0; i–){

I have not tried this so I dont have the complete code, this is just something I thought would get you started

@Reko_Merio there are easy way to set leds with one color:
leds(0,NUM_LEDS) = CRGB::Red;
leds(0,NUM_LEDS) = CRGB::Black;

more here:
https://plus.google.com/102282558639672545743/posts/a3VeZVhRnqG