November 22, 2024, 12:44:49 AM

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.


Chaser

Started by imagineerdan, April 26, 2008, 03:59:21 PM

Previous topic - Next topic

imagineerdan

I have the attached code but want a slightly different effect. Is is possible to have to same look as the attached code but have a group of 2 or 3 pins chase together down the chain. Starting at the top like I have?

JonnyMac

You can only PWM one pin at a time, so I don't think you'll get the look you're after.  If you went with straight digital outputs then you could use a data table to control the sequence with moving outputs.
Jon McPhalen
EFX-TEK Hollywood Office

imagineerdan

How would I make this code PWM slowly on pin1 pause for 600 milliseconds then move on to its routine running through the rest of the pins

JonnyMac

Do me a favor and describe what you ultimately want to see (in English, not code).  I'll be back in the office tomorrow night so I can actually connect things.
Jon McPhalen
EFX-TEK Hollywood Office

imagineerdan

No problem. I want it to pwm on pin0 and pause for 800 miliseconds then pin1-12 pwm on then of in ascending order (just like the attached code) Thanks Jon!

JonnyMac

April 27, 2008, 10:05:06 PM #5 Last Edit: April 28, 2008, 08:00:35 AM by JonnyMac
What happens when you move from pin X to pin X+1?  These are the kinds of details a contract programmer -- even a freebie like me <wink> -- needs to know to do the job.   Give me the full picture in English, please, not a partial program; that will help everyone learn from the process.  Thanks. 

I know it seems like a pain in the tail, but once you can start articulating your programs, you'll find them easier to write.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Maybe this is what you're looking for:

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              see: http://creativecommons.org/licenses/by/3.0/us/
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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


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

FirstPin        CON     0
LastPin         CON     12

Speed           CON     1                       ' bigger = slower fade


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

thePin          VAR     Byte
level           VAR     Byte


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

Reset:
  OUTS = %0000000000000000
  DIRS = %0001111111111111


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

Main:
  FOR thePin = FirstPin TO LastPin
    FOR level = 0 TO 255                       ' fade up
      PWM thePin, level, Speed
    NEXT
    HIGH thePin                                 ' hold on
    PAUSE 800                                   ' wait
    LOW thePin                                  ' turn off
  NEXT

  GOTO Main


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


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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office