NeoPixel Ring with Arduino as control board

Commands sent from the EZ-B to the Arduino

The top portion of the sketch contains all of the commands that the Arduino can accept. Some commands take more parameters than others. Below are the comments that are in the script which outline each command and its needed parameters.


/ Serial Commands
/     Cr1,g1,b1  - Set whole Ring to same color specified by r1,g1,b1
/     Rt,d  - Rainbow  with interval t and direction d
/     Tr1,g1,b1,r2,g2,b2,t,d - Theater Chase between color r1,g1,b1 and color r2,g2,b2 with interval t and direction d
/     Wr1,g1,b1,t,d - Color Wipe in  color r1,g1,b1 with interval t and direction d
/     Fr1,g1,b1,r2,g2,b2,s,t,d - Fade between color r1,g1,b1 and color r2,g2,b2 in s steps with interval t and direction d
/     Sr1,g1,b1,t  - Scanner with color specified by r1,g1,b1 and interval t
/     Pp,r1,g1,b1 - Set individual pixel p to color specified by r1,g1,b1
/
/    p = pixel number
/    r1 = 1st color red values 0 to 255
/    g1 = 1st color greern values 0 to 255
/    b1 = 1st color blue values 0 to 255
/    r2 = 2nd color red values 0 to 255
/    g2 = 2nd color greern values 0 to 255
/    b2 = 2nd color blue values 0 to 255
/    s = number of steps
/    t = interval time values 0 to 255
/    d = direction  0 = Forward 1 = Backward  
*/

If you used the wiring section that I provided, you should be able to use this example script in ARC to run through a few of the different modes for the NeoPixel.

This command will send a serial command from digital pin 5 at 9600 baud of "C100,1,1" which will turn the ring red.


sendserial( D5, 9600, "C100,1,1")

This command will send a serial command from digital pin 5 at 9600 baud of "R20.0" which will make a rainbow effect.


sendserial( D5, 9600, "R20,0")

This command will send a serial command from digital pin 5 at 9600 baud of "T100,1,1,1,100,1,20,0" which will make a a theater chase effect.


sendserial( D5, 9600, "T100,1,1,1,100,1,20,0")

With these examples, you should be able to see how the parameters are passed and used.

To turn off the NeoPixel, just send a command of C0,0,0 to the controller. This sets all pixels to off.


sendserial( D5, 9600, "C0,0,0")


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

PRO
Synthiam
#2  

Are they neopixel led strips? Then yes. If they’re not then, no.

PRO
USA
#3   — Edited

With this set up....is it NOT possible to use dynamixels at same time as the Neopixels, because they both use D5?

PRO
Synthiam
#4  

There’s 3 uart on the EZ-B v4. Which means you can use Dynamixels by having this run on a different port.

Maybe I’ll demonstrate neopixelon next hack night if you’d like?

PRO
USA
#5  

That would be fantastic!

PRO
USA
#7  

I know we all ran outta juice on Friday night:), so do you think you could cover this on the next Hack?