Daisy Chaining Shiftbrites

Hello,

I am new to the Maestro’s coding lanuage and I just need help on code for 2 daisy chained shiftbrites. I read the resources attached to the shiftbrites page but I do not know to translate arduino code into maestro code, and I cannot find any example codes for a daisychained setup. For the most part both shiftbrites will be displaying the same color, and maybe flashing between 2 different colors.

If someone could provide me with an example code or let me know where I can go to learn how to do the daisy chain, I would appreciate it. Thank you.

Hello,

Have you seen our example Maestro program (at the end of this page)? The following lines in that program shift out three 10-bit values plus the two command bits required for the ShiftBrite, for a total of 32 bits:

  0 send_bit # this bit does not matter
  0 send_bit # the "address" bit - 0 means a color command
  swap rot rot
  send_10_bit_value 
  send_10_bit_value 
  send_10_bit_value

If you want to send two sets of RGB colors to two ShiftBrites, you should be able to just duplicate this block of code. That will cause it to shift out two sets of color commands instead of one, for a total of 64 bits. Then, when you call the rgb function, you will need to give it two sets of RGB values. For example:

1023 511 255 1023 511 255 rgb  

will set the two to the same color. Notice that the latch pin is only toggled once if you do it this way - otherwise you would briefly see the colors appear on the wrong ShfitBrites before they get shifted onto the correct ones.

-Paul

By the way, I have not actually tried this code, so please let me know if it does not work for you (and post your complete code).

-Paul

Thanks Paul, I will try that this weekend and let you know how it turns out

So I tried the code out and it works. I have made the shiftbrites alternate between blue and orange colors. Here is the code in case any wants it for an example:

begin
1020 297 0 0 264 1023 rgb 
1000 delay
0 264 1023 1020 297 0 rgb
1000 delay
repeat

# Subroutine for setting the RGB value of a ShiftBrite/ShiftBar.
# example usage: 1023 511 255 rgb
sub rgb
0 send_bit # this bit does not matter
0 send_bit # the "address" bit - 0 means a color command
swap rot rot
send_10_bit_value
send_10_bit_value
send_10_bit_value

0 send_bit # this bit does not matter
0 send_bit # the "address" bit - 0 means a color command
swap rot rot
send_10_bit_value 
send_10_bit_value 
send_10_bit_value

0 1 8000 1 servo servo # toggle the latch pin
return

# sends a numerical value as a sequence of 10 bits
sub send_10_bit_value
512
begin
dup
while
over over bitwise_and send_bit
1 shift_right
repeat
drop drop
return

# sends a single bit
sub send_bit
if 8000 else 0 endif
2 servo # set DATA to 0 or 1
0 0 8000 0 servo servo # toggle CLOCK
return

sub stopper
0 0 0 rgb
quit

Thanks again Paul. I would also like to know if it is possible to use a “get_moving_state” command to make the shiftbrites slowly dim or get brighter? Or would there be an easier way of programming that sort of action? I will test it out and see how it works.