i’ve got a ShiftBriter Led and a maestro servo (24 servos). i know how to use MaestroServo to control servos but no how to use ShiftBriter (even after reading the shiftBriter manual).
I’ll write a programm in C/C++ language and i don’t know what to send for the ShiftBriter. Is there a command like servo control (polulu serial protocol for example) ?
I would like to set the led color as i wish with a c/C++ programm. I try to use the same command as servo control but i can only put ON/OFF the led (i set data to 2300 value = ON, 3120 = OFF) with tricks…
So, I think I don t understand how the shiftbriter works and I would like to know if it is possible to control the colour led with C/C++ language.
Thanks for your help. (and sorry for my huggly english)
Have you seen the section of the Maestro documentation that explains how to connect it to a ShiftBrite and what script to put on the Maestro? It’s in the example scripts section.
Are you trying to control the ShiftBrite from your computer? If you don’t care about controlling it from your computer, you might be able to only write a script for the Maestro to accomplish what you want.
Is your C/C++ program capable of sending serial commands to the Maestro? You can use the Serial Script Commands and your own Maestro script to accomplish some level of computer control.
I want to add that an easy way to control the ShiftBrite from a C/C++ program would be to have the following script on the Maestro. The idea is that the ShiftBrite is connected to channels 0, 1, and 2 as in the example code that Ryan linked to, and the R, G, and B values are constantly read from channels 3, 4, and 5, which should be configured as servos with the default min and max values. Setting the positions of channels 3, 4, and 5 using a serial command from C/C++ will cause the LEDs to change color correspondingly - or you can just use the sliders in the Control Center.
You can even configure speed and acceleration for smooth color-changing effects. I am testing this out right now, and it looks pretty nice!
3 get_position 3968 minus 4 divide
4 get_position 3968 minus 4 divide
5 get_position 3968 minus 4 divide
# Subroutine for setting the RGB value of a ShiftBrite/ShiftBar.
# example usage: 1023 511 255 rgb
0 send_bit # this bit does not matter
0 send_bit # the "address" bit - 0 means a color command
swap rot rot
0 1 8000 1 servo servo # toggle the latch pin
# sends a numerical value as a sequence of 10 bits
over over bitwise_and send_bit
# sends a single bit
if 8000 else 0 endif
2 servo # set DATA to 0 or 1
0 0 8000 0 servo servo # toggle CLOCK
Thank you all for your answers !
I use the script solution and I call the subroutine I need with the UscCmd. That s working perfectly !