NEO.SHIFT

Feature requested and implemented
Post Reply
cm99
Posts: 3
Joined: Fri Mar 05, 2021 9:04 pm
Been thanked: 3 times

NEO.SHIFT

Post by cm99 »

In these Christmas holidays I have resumed an old strip of neopixel LEDs to decorate an environment.
The self-made controller use an old basic program for ESP8266.

I updated the controller with Annex but I stopped on a NEO.SHIFT instruction that I didn't find.

NEO.SHIFT ()
neo.shift ({start pixel}, {end pixel}, {direction, 1 for forward, -1 for reverse.})
Will display a shift effect. This allows some nice scrolling animations with very little effort.

I tried to do it again in basic, it works, but obviously it doesn't have the speed of the native command.

Is there a similar command in ANNEX?

Greetings and happy holidays.
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 119 times
Been thanked: 132 times

Re: NEO.SHIFT

Post by AndyGadget »

That's strange. I've been doing a few things with small neopixel strips and the lack of a shift comand didn't register with me. I've been shifting my bits manually, but only for 12 neopixels or so. I'd have twigged if I'd been shifting more, I'm sure.
Go on Francesco, give us a SHIFT command :D
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 119 times
Been thanked: 132 times

Re: NEO.SHIFT

Post by AndyGadget »

Hi Francesco.
Any chance of slipping this in?
It's an obvious complement to the neopixel switching commands.
NEO.SHIFT <From LED> <To LED> <Direction> or somesuch.
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1260 times
Contact:

Re: NEO.SHIFT

Post by cicciocb »

Ok, I'll include in a next release
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1260 times
Contact:

Re: NEO.SHIFT

Post by cicciocb »

HI all,
I played with neoxpixels on the web simulator a little bit and I'm in the process to include these commands in the next coming release.
https://wokwi.com/projects/346887874044494420

This demo shows what can be done; included in the demo there is a little explanation on the new commands available.


I'm open to accept any suggestions about the possibility to include new commands.

This will be a nice addition for the next coming holidays.
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1260 times
Contact:

Re: NEO.SHIFT

Post by cicciocb »

Implemented in the version 1.48.2
User avatar
Electroguard
Posts: 835
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 267 times
Been thanked: 317 times

Re: NEO.SHIFT

Post by Electroguard »

Thanks for the NEO additions, and some feedback...
I see that SHIFT moves pixels along until they drop off the end, whereas ROTATE wraps them back around.
Are there any examples of NEO.BILINEARBLEND anywhere ?

NEO.DIM is handy, but of course once the r,g,b ratio can no longer be maintained it turns into a colour changer.
To act just as a dimmer requires preventing any further value changes that would cause any r,g,b value to become less than 0 or greater than 255, but NEO.DIM does not have any such optional limit.

Which means the r,g,b values need to be monitored to ensure they do not exceed limits. But all the NEO functions return a single combined RGB value, not the individual r,g,b components... so perhaps NEO.GETPIXEL might optionally be able to return the 3 individual r,g,b values.

Or something like a NEO.SPLIT function might be generally more useful for splitting a single combined RGB value into its individual r,g,b components.


down:
rgb_ratio = neo.getpixel(0)
'get the r,g,b values of first pixel
neo.strip 0,npixels-1,neo.dim(rgb_ratio, 0.8) 'adjust brightness only if able to maintain the same colour ratios
return

up:
rgb_ratio = neo.getpixel(0)
'get the r,g,b values of first pixel
neo.strip 0,npixels-1,neo.dim(rgb_ratio, 1.2) 'adjust brightness only if able to maintain the same colour ratios
return
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1260 times
Contact:

Re: NEO.SHIFT

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jan 10, 2023 2:00 pm
Are there any examples of NEO.BILINEARBLEND anywhere ?
Look at this example here :

https://wokwi.com/projects/353567578278594561
User avatar
Electroguard
Posts: 835
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 267 times
Been thanked: 317 times

Re: NEO.SHIFT

Post by Electroguard »

Thanks for that - hah, was like watching a magic trick right ... can see it happening, but not sure what or how (is probably the trigonometry causing blurred vision).

Got me thinking though, might be an idea to create a forum topic where links to all the available Annex Wokwi Demos can be kept for anyone to browse through at any time, without even needing any hardware.
Post Reply