Go Down

Topic: PROBLEM making WS2812B work from END to START  (Read 489 times) previous topic - next topic

eesaam0nx

I have added this code and it seems to be doing the exact same thing as before. Basically, after it goes from the 203rd pixel to the 1st it should then turn off from the 203rd to the 1st instead of turning off from the 1st to the 203rd. On the way down the stairs if it turns off from the 1st pixel to the last one then the leds are travelling in the opposite direction to what you are walking when we need them so that they follow you down the stairs. 

For the shooting star bit, at the end of each motion I want it just to have a pixel going through the strip with a small trail behind it, I will attach a video for more understanding.

https://www.youtube.com/watch?v=XGI4a28PbTc

PaulRB

#16
Nov 22, 2020, 03:48 pm Last Edit: Nov 22, 2020, 03:56 pm by PaulRB
Quote
I have added this code...
Added what? EDIT: oh, you mean you made the change I suggested in reply #12. It is better like that, but it will not fix the problem. Did you see my reply #13?

eesaam0nx

Sorry, I should have mentioned......i do not intend to have LEDs on each stair tread. I am using a strip of LEDs that go on the side of the stairs as one whole piece.

Just want to also say that I appreciate all the help i am getting from you guys.....its greatly appreciated and good to know to you can turn to the experts for help when needed  ;)

PaulRB

No problem.

Did you find that error yet? It is a very small error, a simple mistake. You will curse yourself when you find it. That is normal in the process of de-bugging code!

eesaam0nx

I have not found it yet maybe hint me in the right direction?

PaulRB

Ok, let me try to give you a hint without ruining your fun. Your code has two functions,  one for switching on leds 0 to 202 in that sequence. The other for switching leds 202 to 0 in that sequence. What would happen if you used the wrong function in the wrong place?

eesaam0nx

So after going through the code again, again and again, i noticed the error in the coding.

As you correctly said, having the wrong function in the wrong place would cuase the sequence required not to work correctly.

Right, now that's working, i'll take a break and decide whether i am now happy with my setup or i add 

Thanks to all for the help

Paul__B

I am using a strip of LEDs that go on the side of the stairs as one whole piece.
One side or both?

If you have LEDs on both sides, clearly you can have the two connected to the same control pin and tracking in parallel.  :smiley-lol:

eesaam0nx

Just the one side...trying to keep it simple and not complicate matters

Got everything working in terms of how i want the lights to sweep but just thinking it would be good to have a shooting star in the same or different colour just after the sweep and then LEDs switch off till the sensor at top or bottom is triggered again.

I'm playing around at the mo and exploring different options.....happy with the current setup but anything extra would be good

PaulRB

Quote
As you correctly said, having the wrong function in the wrong place would cuase the sequence required not to work correctly.
Well done. +1 karma

Go Up