November 21, 2024, 11:53:16 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Lamp dimming

Started by jukingeo, September 21, 2007, 07:45:33 AM

Previous topic - Next topic

jukingeo

Hello,

I am curious as to what has to be done to dim a lamp attached to the outputs of the the BS2.

Jon, I am wondering if this could be put in the context of that chaser/random flasher program you conjured up for me. In other word change one of the random flashers to 'slowly dim and get bright again'.

Thanx,
Geo

JonnyMac

September 21, 2007, 07:54:29 AM #1 Last Edit: September 21, 2007, 07:57:09 AM by JonnyMac
The Prop-1 and Prop-2 have a command called PWM that can dim an LED or DC lamp (connected to an OUTx terminal) from full off to full on (or vice versa).   We use the PWM command for creating digital fireflies or spooky eyes-in-the-bushes effects.  The difficulty with PWM is that it must run in a loop, uninterrupted, to create the effect so that prevents it's use with your program.

This code demonstrates PWM:

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Led             PIN     8


' -----[ Constants ]-------------------------------------------------------

IsOn            CON     1                       ' for active-high in/out
IsOff           CON     0


' -----[ Variables ]-------------------------------------------------------

level           VAR     Byte


' -----[ Initialization ]--------------------------------------------------

Reset:


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR level = 0 TO 255
    PWM Led, level, 3
  NEXT
  FOR level = 255 TO 0
    PWM Led, level, 3
  NEXT
  GOTO Main
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Hello Jon,

Is it possible to nest loops and thus have more than one lamp dimming perhaps at different rates, or you can only do one at a time?  If you can only do one at a time then I am sure that you could perhaps raise and dim one light a couple of times and then move on to another light, correct?  Also is there a way to control the rate of the dim, or is that a set value.

Thanx Geo

JonnyMac

With PWM on the Prop-1 and Prop-2 you can only do one at a time; after the instruction (loop) you can leave them full on (with HIGH) or full off (with LOW).  You can control the rate of dimming with the loop iterations (0 to 255 with no step is the longest) and the duration of the PWM instruction.  See the online docs for details.
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Hello Jon,

Ok, thanx for the information.  I will play with this when I get home. 

Geo

jukingeo

Hello all!

This is a new program I came up with that does a 2 by 6 chase and as it is chasing that entire display slowly dims and brightens.

The program was basically my attempt at trying to dim more than one channel at a time.  It works but there is some noticable flicker.

(Other programs follows this one so be careful when cutting and pasting).

' =========================================================================
'
'   File...... Dimming Chaser
'   Purpose...
'   Author.... Jukingeo
'   E-mail.... jukingeo@optonline.net
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Speed           PIN     15                 'flash rate pot adjust

' -----[ Constants ]-------------------------------------------------------

dimstep      CON     40                    'how fast is dimming action


' -----[ Variables ]-------------------------------------------------------

set             VAR     Word               'dim level setting
chase           VAR     Word               'chaser LED output
second          VAR     Nib                'follow LED output
delay           VAR     Word               'sets chaser delay

' -----[ Initialization ]--------------------------------------------------


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR set = 5 TO 255 STEP dimstep                 'sets dim level up
    GOSUB Subroutine
  NEXT
  FOR set = 255 TO 5 STEP dimstep                 'sets dim level down
    GOSUB Subroutine
  NEXT
GOTO main                                         'rinse and repeat

Subroutine:
  FOR chase = 8 TO 13                             ' chaser loop
    HIGH Speed                                    ' charge RC circuit
    PAUSE 1
    RCTIME Speed, 1, delay                        ' read raw delay
    delay = delay / 3 + 50                        ' set new range
    PWM chase, set, 10                            ' sets LED output
    second = chase + 1                            ' sets 2nd follow LED output
    IF second > 13 THEN second = 8
    PWM second, set, 10
'   DEBUG CLS, DEC set                            ' turns on pot value to screen
    PAUSE delay
  NEXT
RETURN

-----------------------------------------------------------------------------------------------------------------------------------------

This program is similar to the one above, but instead of the chaser being dimmed automatically, this one changes the pot from a speed control to a manual dimmer.  The effect is far nicer than the one above and there is less flicker.  Again this program is an attempt in trying to dim more than one output at a time.

' =========================================================================
'
'   File...... Dimmable Chaser
'   Purpose...
'   Author.... Jukingeo
'   E-mail.... jukingeo@optonline.net
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Led             PIN     8
dimming         PIN     15

' -----[ Constants ]-------------------------------------------------------

IsOn            CON     1                       ' for active-high in/out
IsOff           CON     0


' -----[ Variables ]-------------------------------------------------------

set             VAR     Word
chase           VAR     Word
second          VAR     Nib

' -----[ Initialization ]--------------------------------------------------

' -----[ Program Code ]----------------------------------------------------

Main:
FOR chase = 8 TO 13                             ' chaser loop
  HIGH dimming                                  ' charge RC circuit
  PAUSE 2
  RCTIME dimming, 1, set                        ' read raw delay
  IF set > 255 THEN set = 255                   ' set new range
  PWM chase, set, 10                            ' sets LED output
  second = chase + 1                            ' sets 2nd led output
  IF second > 13 THEN second = 8
  PWM second, set, 10
' DEBUG CLS, DEC set                            ' turns on pot value to screen
  PAUSE 35
NEXT
GOTO Main

------------------------------------------------------------------------------------------------------------------------------------------

This is an alternating LED dimmer.  When LED1 is bright, LED2 dims and then vice versa.  This was actually my first foray into trying to dim two LED's independently.  It works great, but I found that trying to speed up the dimming cycle by using STEPS on the FOR NEXT loop causes problems.

So overall you can dim more than one output and in more than one direction.  The problem lies in the fact that because the PWM command MUST be in a loop, if you try and (lets say) set LED 1 at 50% brightness and want to keep it there... you would be out of luck.  If it is in a loop you can, but if the loop is long, you may get flicker.  If you have conditionals that direct you out of the loop the LED shuts off

' =========================================================================
'
'   File...... AltnateDimLeds
'   Purpose...
'   Author.... Geo
'   E-mail.... jukingeo@optonline.net
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Led1             PIN     8
Led2             PIN     9

' -----[ Constants ]-------------------------------------------------------




' -----[ Variables ]-------------------------------------------------------

timer            VAR     Byte
level1           VAR     Byte
level2           VAR     Byte

' -----[ Initialization ]--------------------------------------------------

Reset:



' -----[ Program Code ]----------------------------------------------------

Main:

level1 = 0
level2 = 255
  FOR timer = 0 TO 255

    PWM Led1, level1, 3
    PWM led2, level2, 3
    level1 = level1 + 1
    level2 = level2 - 1
  NEXT

level1 = 255
level2 = 0

  FOR timer = 0 TO 255

    PWM Led1, level1, 3
    PWM led2, level2, 3
    level1 = level1 - 1
    level2 = level2 + 1
  NEXT

GOTO Main

--------------------------------------------------------------------------------------------------------------------------------------------

This last program attempts to illustrate what happens when an attempt is made to keep an LED on within a loop.  It just doesn't work the pulsed LED just flickers.  However, if the timing loop is fast enough is is possible to carry out more than one operation and still have the dimmed LEDs 'appear' to be steadily on as the second part of the program illustrates.  THIS is something I found intriguing and I am going to experiment more with this characteristc of the PWM command.

Here is the program:

' Dimming test program created by jukin'geo
'
'
' Failed attempt at trying to keep 1 LED on dimmed.
' Trying to do other timed tasks in a loop will cause the dimmed LED to
' flicker. However, if no timing is is used it is possible to have sustained
' outputs with varying brightness as demonstrated in the second part of the
' program below
' {$STAMP BS2}
' {$PBASIC 2.5}

'-----------Definitions----------------------------------

led1    PIN 8
led2    PIN 9
led3    PIN 10
led4    PIN 11
led5    PIN 12
led6    PIN 13

'-----------Variables

cycle   VAR   Word
counter VAR   Word

'-----------Dimmed LED Flicker---------------------------

DO

FOR cycle = 1 TO 50                   'repeat for 'x' iterations
  PWM led5, 50, 3                     'turns on LED 12 but dimmed
  HIGH 8                              'turns on LED on Pin 8
  LOW 9                               'turns off LED on Pin 9
  PAUSE 100                           'Pauses for 200ms
  LOW 8                               'turns off LED on Pin 8
  HIGH 9                              'turns on LED on Pin 9
  PAUSE 100                           'Pauses for 200ms
NEXT

' 6 LEDs outputed at different brightness levels

FOR counter = 1 TO 300                'repeat for 'x' iterations
  PWM led1, 5, 3                      'sets different brightness for
  PWM led2, 15, 3                     'each led
  PWM led3, 30, 3
  PWM led4, 60, 3
  PWM led5, 100, 3
  PWM led6, 255, 3
NEXT

PAUSE 2000                            'pause for 2 seconds

LOOP                                  'rinse and repeat

JonnyMac

October 21, 2007, 12:49:14 PM #6 Last Edit: October 21, 2007, 01:03:45 PM by JonnyMac
If you really want dimmed LEDs while you're able to do other things, the Prop-SX is the way to go.  It's a little trickier, but gives the [willing] programmer tremendous power. 

And let me show you a math trick that may help improve performance. You're doing this:

  second = chase + 1                   
  iF second > 13 THEN second = 8


You could replace it with this:

  second = ((chase - 7) // 6) + 8

The reason that this helps with performance is that it's all on one line and in fact a single expression (your second line is actually two), therefore, will be fetched from the EEPROM at one time; any time you can cut down on token fetching from the EEPROM you'll speed up the program.

It breaks down like this:

  chase - 7

... this is the same as chase - 8 + 1; the purpose is to zero-align the value and then add one to it.

  // 6

... this keeps the value in the 0 to 5 range, handling roll-over automatically.

  + 8

... realigns the pin with the upper output group.
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Hello Jon,

Thanx for the input on the modulus operator.  It is funny I have been working with these since I first saw them in your programs and also in the documentation that I found in your Stampworks book.   I guess in this instance I just didn't 'see' it.

I only just have begun to work with the modulus operator when it comes to creating an end point or setting it up for a reverse loop. 

For example

x = x + 1 // 6   (which loops forward to 0 after 6)

Then there is the other one

x = x + 5 // 6  (which will count back to 0 from 6)

I have been using the modulus operator in quite a few of my chase programs  I just didn't see it here.

While I have you, I did want to ask you another dimming related question.  Since I managed to get two leds to dim up and down alternately, and with the demonstration I created above, I also could get 6 leds to light up with different brightnesses AT THE SAME TIME.  Now with this knowledge in mind I want to push the envelope and use the 6 leds and 'create a wave' Raising each succeeding LED up by an evenly spaced lower dimming value.  Not only do I want to bring them up like this, but also back down, thus creating a wave effect.   I have been trying to set up six PWM registers each outputing to one LED within a loop.  Thusfar I couldn't get it to work.

I will say that overall, I am amazed at how far I got with dimming on the BS2.

Thanx,
Geo

JonnyMac

You may have "pushed the envelope" right up to the ceiling for the BS2.  On possibility to consider, though, is using a LOOKUP table to set the pin numbers that correspond to a given brightness.  Using a loop within a loop you *might* be able to get the moving effect you're looking for.
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Quote from: JonnyMac on October 21, 2007, 07:35:36 PM
You may have "pushed the envelope" right up to the ceiling for the BS2.  On possibility to consider, though, is using a LOOKUP table to set the pin numbers that correspond to a given brightness.  Using a loop within a loop you *might* be able to get the moving effect you're looking for.

Hello Jon,

Yeah, heh heh, well, I DO want to see what I can really do with the Prop-2.  So far it has exceeded my expectations and I did manage to do things with the BS2 that I thought were only possible with the SX.   

Anyway, after examining one of the programs you wrote for me early on (the selectable pattern chaser), I saw the LOOKUP commands there and I read up on the command and how it works. 

I did get the same idea you mentioned above.  But implenting it in an efficient manner is something that eludes me.  I envisioned creating 6 LOOK UP channels and then just have the program step through the individual values using a PWM command for each channel to 'flash' a snapshot of those settings.  Setting an offset in the look up table for each channel would create the wave effect.  But thusfar I can only envision doing this one way as the LED output loop must continue in a 'forward' direction.  Going up and then down in a wave fashion is where I am at a loss in my mind unless of course I put the values going down in the lookup table as well.  That would solve the problem and the program would be kept simple.  But the downside is that by going through individual values for the smoothest output would result in a massive lookup table.  Skipping some values to make the program smaller does seem like an option, but then I was thinking about 'choppy' performance.

Of course, this is an extreme situation of dimming control with the BS2, but when I found I was able to light up all 6 LED's at a different brightness level, I knew I could take this one step further.

Anyway, this is what I come up with...I wrote this at my job and thus couldn't verify operation on my Prop-2.  For simplicity I did this for four channels only and I didn't include the lookup table which is what would be the largest part of the program.  This is as simple as I could think of how to do this.  But I am not sure if it will even work.


' {$STAMP BS2}
' {$PBASIC 2.5}


'----------------Definitions------------------------


led1  PIN  8
led2  PIN  9
led3  PIN  10
led4  PIN  11


'----------------Variables---------------------------

scale1    VAR byte
scale2    VAR byte
scale3    VAR byte
scale4    VAR byte

offset1   VAR Word
offset2   VAR word
offset3   VAR word
offset4   VAR word

'----------------Initialization-----------------------

offset1 = 0
offset2 = 1
offset3 = 2
offset4 = 4

'----------------Program Code-------------------------

Main:

LOOKUP offset1, [ledtab], scale1
LOOKUP offset2, [ledtab], scale2
LOOKUP offset3, [ledtab], scale3
LOOKUP offset4, [ledtab], scale4

PWM led1, scale1, 3
PWM led2, scale2, 3
PWM led3, scale3, 3
PWM led4, scale4, 3

offset1 = offset2 + 1 // 511    '511 is max resolution 0 to 255 up and then
offset2 = offset2 + 1 // 511    '255 to 0 back down.  Program itself runs in
offset3 = offset3 + 1 // 511    'one direction and then loops back on the
offset4 = offset4 + 1 // 511    'lookup table.

PAUSE '(FOR any delay desired in program OR perhaps create a pot delay here)

GOTO main.


'------------------Lookup Table

ledtab:  '(values would be placed here all 512 settings going up and back down.

JonnyMac

October 22, 2007, 09:38:21 AM #10 Last Edit: October 22, 2007, 09:40:19 AM by JonnyMac
Perhaps this is the effect you're looking for.  I used READ instead of LOOKUP as it simplified the code.  The key here is that the PWM output levels are moved into a structured table so that you can move the levels around, pin-to-pin, based on their placement in the table.

' =========================================================================
'
'   File...... Dim_Wave.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2007 EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Led6            PIN     13
Led5            PIN     12
Led4            PIN     11
Led3            PIN     10
Led2            PIN     9
Led1            PIN     8


' -----[ Constants ]-------------------------------------------------------


' -----[ Variables ]-------------------------------------------------------

level1          VAR     Byte
level2          VAR     Byte
level3          VAR     Byte
level4          VAR     Byte
level5          VAR     Byte
level6          VAR     Byte

cycle           VAR     Nib
hold            VAR     Byte


' -----[ Initialization ]--------------------------------------------------

Reset:
  DIRH = %00111111


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR cycle = 0 TO 5
    READ (cycle * 6), level1, level2, level3, level4, level5, level6
    FOR hold = 1 TO 4
      PWM Led1, level1, 3
      PWM Led2, level2, 3
      PWM Led3, level3, 3
      PWM Led4, level4, 3
      PWM Led5, level5, 3
      PWM Led6, level6, 3
    NEXT
  NEXT
  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------

Levels          DATA      5,  15,  30,  60, 100, 255
                DATA     15,  30,  60, 100, 255,   5
                DATA     30,  60, 100, 255,   5,  15
                DATA     60, 100, 255,   5,  15,  30
                DATA     100, 255,  5,  15,  30,  60
                DATA     255,  5,  15,  30,  60, 100
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Hello Jon,

The program you wrote, pretty much gets the idea of what I after and it does work well.  However,  it only ramps up the LED's and not down as well.

I been playing with your program tonight and came up with this (see attached program).

The changes I made are as follows:

1) Expanded the data output to reflect both up AND down, now you can clearly see that there is 'Wave' effect.
2) I have added a speed control and played around with dividing the output until I obtained the range I desired.  In this case it is a very small change...on the order of about 0 to 9 for the FOR NEXT loop.
3) I have also added a direction control using the button so I can change the direction of the wave.

Results:   As I was afraid of, during slow chases there is a noticable 'stepping' in the wave pattern and a tiny amount of flicker.  However, during a fast chase the program seems to run pretty smooth and the stepping isn't as noticable.  I have been thinking about doubling the resolution of the data lookup table to reduce the visual effects of stepping.

But overall this is pretty much what I was attempting.  This program basically proves that you CAN crossfade dimming on more than one output at a time.

I can see this going another step further.  With the lookup table system and use of the RANDOM command I could see this program being changed around to create a random 'level' fetch to create a flickering effect in multiple lamps.

With a few tricks I can see other uses or directions to take this program.  For one it does show another instance of 'faked' multi-tasking.

Thanx again for your help.

Geo
=========================================================================
'
'   File...... Dim_Wave.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2007 EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... by Jukin'Geo
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
' This program demonstrates that it is possible to dim multiple channels
' using a look up table on the Prop-2

' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

speed           PIN     15
switch          PIN     14

Led6            PIN     13
Led5            PIN     12
Led4            PIN     11
Led3            PIN     10
Led2            PIN     9
Led1            PIN     8


' -----[ Constants ]-------------------------------------------------------

IsOn      CON      1
IsOff     CON      0

' -----[ Variables ]-------------------------------------------------------

level1          VAR     Byte                     'Led Level variables for
level2          VAR     Byte                     'Loopup Table
level3          VAR     Byte
level4          VAR     Byte
level5          VAR     Byte
level6          VAR     Byte

cycle           VAR     Byte                     'Look up table pointer
hold            VAR     Byte                     'Output Delay loop

delay           VAR     Word                     'Output Delay Value
direction       VAR     Bit                      'Sets switch status
offset          VAR     Byte                     'Sets direction offset

' -----[ Initialization ]--------------------------------------------------

Reset:
  DIRH = %00111111

' -----[ Program Code ]----------------------------------------------------

Main:

IF (switch = IsOn) THEN                        'Checks to see if button is pressed
  direction = direction ^ 1                    'Flip Bit
  DO WHILE (switch = IsOn)                     'Locks out program until switch is
  LOOP                                         'released.
ENDIF

LOOKUP direction, [1, 9], offset               'Sets offset pointer for direction control
cycle = cycle + offset // 10                   'Up/Down counter

READ (cycle * 10), level1, level2, level3, level4, level5, level6   'Looks up level data

  FOR hold = 0 TO delay                        'Slows output via pot
    PWM Led1, level1, 3                        'LED PWM outputs
    PWM Led2, level2, 3
    PWM Led3, level3, 3
    PWM Led4, level4, 3
    PWM Led5, level5, 3
    PWM Led6, level6, 3
  NEXT

  HIGH Speed                                   ' charge RC circuit
  PAUSE 1
  RCTIME Speed, 1, delay                       ' read raw delay
  delay = delay / 30                           ' set new range

  GOTO Main                                    ' Rinse and repeat


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------

Levels          DATA     5,  30,  60,  100, 150, 255, 150, 100, 60, 30
                DATA     30,  60,  100, 150, 255, 150, 100, 60, 30, 5
                DATA     60,  100, 150, 255, 150, 100, 60, 30, 5, 30
                DATA     100, 150, 255, 150, 100, 60, 30, 5, 30, 60
                DATA     150, 255, 150, 100, 60, 30, 5, 30, 60, 100
                DATA     255, 150, 100, 60, 30, 5, 30, 60, 100, 150
                DATA     150, 100, 60, 30, 5, 30, 60, 100, 150, 255
                DATA     100, 60, 30, 5, 30, 60, 100, 150, 255, 150
                DATA     60, 30, 5, 30, 60, 100, 150, 255, 150, 100
                DATA     30, 5, 30, 60, 100, 150, 255, 150, 100, 60

livinlowe

Geo-
I've been reviewing your program and have a question. Why do you have 10 data statements in a row and only six LED's? If you were planning on upscaling to 10 then I'm not confused, but if not, well yeah then I'm confused!

Thanks
Shawn
Scaring someone with a prop you built -- priceless!

jukingeo

July 23, 2008, 07:21:00 AM #13 Last Edit: July 23, 2008, 07:31:35 AM by jukingeo
Quote from: livinlowe on July 21, 2008, 02:54:37 PM
Geo-
I've been reviewing your program and have a question. Why do you have 10 data statements in a row and only six LED's? If you were planning on upscaling to 10 then I'm not confused, but if not, well yeah then I'm confused!

Thanks

You are reading it wrong... The table calls are horizontal, read in a serial fashion, not vertically in rows.  Each pass of the program calls a PWM brightness value.  So it is read 10 across.   Why that instead of six?  Well, keep in mind too that I have a direction control switch in there.   I had to call it up on 10 levels of brightness going up AND down.  So why isn't it 12 steps...well very simple you don't need to call the lowest or highest values twice otherwise you would have a 'stutter' at the top and bottom of the sequence.  The next step in the data sequence just pushes the value one position over.   With Jon's original program there were only six steps because the lights faded on to full brightness and then repeated.  I wanted a 'wave' motion and thus had to expand on it.  With just six steps, it didn't work right.  This program does EXACTLY what I wanted to do.  If you look carefully at the data table the positioning of the values even LOOK like a wave pattern.  So it does make for easy editing and yes, it also does make it easy to expand up to 10 channels if you so desire, but the data table has to be changed of course.

That is why I was telling GOT above with his elevator project...somethings things don't work out right and a 'fix' has to be found.  Jon is fantastic at that approach because of his experience with the Basic Stamp.   I am FAR from an expert, but usually I can see something in one of Jon's masterpieces and then just start altering values and playing around with things so they 'fit' my needs better.

I think in GOT's case a table would have to be made up to have a servo value call, and a light PWM value call, and a 'floor indicator' call.  A timing value would also have to be set to adjust the speed of the sequence considering that the program must run at the 20ms to keep the servos in line.  The timing value would tell the program when to make changes in calling the data value.  Where as the program itself would refresh itself at 20ms.  Because the control of the servos, the dimming of the moving light fixture, AND the elevator's floor indicator would all happen in a synchronized time frame, I believe it should be possible on the BS-2.   I would use this program as a launching point though because it would address the two PWM functions GOT needs for his project.

BTW, Liv...did you download this program and run it?  I works with the Prop-1 Trainer board...hence the reason why it outputs to 6 LED's.  It is a pretty spectacular program...especially when hooked up to incandescent lamps.  The delay on the filament of the bulb really makes the wave effect fluid.   This is one of my favorite programs, BUT you have to thank Jon for that.  He came up with the base program, I just altered it.

Anyway, I have to run.    If you have more questions or if you need help with an alteration to this program, just let me know.

Geo