-->
Page 1 of 2

NEO.HEX()

PostPosted: Mon May 29, 2017 1:58 pm
by Electroguard
I've read the doc entry many times and tried different values in the example, but I still can't understand what the instruction is supposed to do or what is being copied where or why, nor even what format the pixel data is in (it's not simply the hex R G B components) ... so can anyone explain what the Neo.HEX command does and how to use it, please?
NEO.HEX():
neo.hex({pixel data],{start pixel],int{Position in pixel data},{number pixels},{brightness 0-100})
Example:
neo.hex("400fff",0,0,2,10)
Will use the string , starting at the start of the string copy it to the start of the neopixel display, copy 2 pixels, at 10% brighness.

Re: NEO.HEX()

PostPosted: Mon May 29, 2017 3:54 pm
by PeterN
So I was not the only one who was confused when reading this ;-)

Re: NEO.HEX()

PostPosted: Mon May 29, 2017 9:17 pm
by Mmiscool

Re: NEO.HEX()

PostPosted: Tue May 30, 2017 5:25 am
by Electroguard
Thanks, it makes a bit more sense for manipulating pixels in a 16 x 16 grid than it did for a string.

There's a couple of neo entries with slight omissions, I've added my best guess of the missing info and changes in colour in case it helps...

1.
NEO():
Will set the desired pixel led to the color specified with an RGB (Red, Green, Blue) value. No optional last parameter will cause pixels to be written instantly. You can optionally disable instant writing to the neo pixel by using a 1 in the last parameter. This will allow for many pixels to be updated all at once. Use a 0 in the last parameter to simultaneously write all buffered pixels.

neo({LED NO},{R},{G},{B},{optional. Set to 1 disable auto write, set to 0 to write buffered contents})

Example
neo(3,250,250,250) ‘ write to pixel 3 instantly
neo(4,250,250,250,1) ‘buffer pixel 4 for synchronised write later.
neo(5,250,250,250, 0) 'write pixel 5 plus all buffered pixels simultaneously.


2.
NEO.SHIFT() seems to be referring to a missing example
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.
Example
neo.shift(0,20,1)

Will move all the pixels from 0 to 20 up one.