Shop OBEX P1 Docs P2 Docs Learn Events
Shiftbrites Revisited — Parallax Forums

Shiftbrites Revisited

tomcrawfordtomcrawford Posts: 1,126
edited 2012-12-20 08:37 in Robotics
I wanted to take shiftbrites to another level by fading from color to color or black rather than just switching from color to color. Here is a video: http://www.youtube.com/watch?v=dv80ntxxLPo

The code is attached. I used a BS2px because I needed RAM space to keep track of what each SB module was doing.

I wrote a little interpreter with instructions such as FadeRedToBlack or FadeGreenToBlue. Each module has its own program of up to 24 steps. I included Delay instructions so that the modules could get out of sync with each other.

The program loops at label top: . For each of the ten SBs, I recover its parameters (Red/Green/Blue/Instruction/ProgCounter/DelayCounter) from RAM and then dispatch through a huge jump table. Initially this was a SELECT/CASE but I ran out of CASEs (16 max). The code in the jump table does something (such as decrease the red value by one) and goes to the bottom: where it drives the SB string and stores the parameters. Notice that the SB Latch term isn't driven HIGH until all ten SBs have their new values.
Sign In or Register to comment.