Go Down

Topic: Vixen+Arduino mega (Read 2107 times) previous topic - next topic

that-dumb-kid91

Sep 29, 2010, 06:26 am Last Edit: Sep 29, 2010, 06:28 am by that-dumb-kid91 Reason: 1
I am currently working on a halloween/christmas lighting system. i would like to use Vixen to control it all. I would like to use a Arduino mega as a controller. with the abillity to control servos, rgb leds, and relays. i am new to programing and need help. i know i can lose a basic stamp to control relays but i want servos as well. the code for the basic stamp is
Code: [Select]

' =========================================================================
'
'   File...... Vixen_Input_v2.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              (remove my name if you modify and repost)
'   E-mail....
'   Started... 22 DEC 2009
'   Updated... 22 DEC 2009
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Receives channel control data from Vixen using the Generic serial driver.
' The driver should be set as follows:
'
' Baud..... 2400
' Header... (checked) EFX
' Footer... (not checked)
'
' Ensure that the Vixen project has 16 channels defined, even if some are
' not used as this program expects to receive 16 bytes after the "EFX"
' header.  If a channel value is 0-127 the output will be off, if it is
' 128-255 the output will be on.
'
' Vixen event timing should be set to 125ms or higher.


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


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

RX              CON     16                      ' for programming port

Servo           CON     16
' -----[ Constants ]-------------------------------------------------------

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

Yes             CON     1
No              CON     0

#SELECT $STAMP
 #CASE BS2, BS2E, BS2PE
   T1200       CON     813
   T2400       CON     396
   T4800       CON     188
   T9600       CON     84
   T19K2       CON     32
   T38K4       CON     6
 #CASE BS2SX, BS2P
   T1200       CON     2063
   T2400       CON     1021
   T4800       CON     500
   T9600       CON     240
   T19K2       CON     110
   T38K4       CON     45
 #CASE BS2PX
   T1200       CON     3313
   T2400       CON     1646
   T4800       CON     813
   T9600       CON     396
   T19K2       CON     188
   T38K4       CON     84
#ENDSELECT

SevenBit        CON     $2000
Inverted        CON     $4000
Open            CON     $8000

Baud            CON     T2400                   ' do not speed up!


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

buf0            VAR     Byte                    ' channels buffer
buf1            VAR     Byte
buf2            VAR     Byte
buf3            VAR     Byte
buf4            VAR     Byte
buf5            VAR     Byte
buf6            VAR     Byte
buf7            VAR     Byte
buf8            VAR     Byte
buf9            VAR     Byte
buf10           VAR     Byte
buf11           VAR     Byte
buf12           VAR     Byte
buf13           VAR     Byte
buf14           VAR     Byte
buf15           VAR     Byte


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

Reset:
 OUTH = %00000000 : OUTL = %00000000           ' clear all
 DIRH = %11111111 : DIRL = %11111111           ' set outputs


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

Main:
 SERIN RX, Baud, [WAIT("EFX"), STR buf0\16]    ' wait for stream

 OUT0  = buf0.BIT7
 OUT1  = buf1.BIT7
 OUT2  = buf2.BIT7
 OUT3  = buf3.BIT7
 OUT4  = buf4.BIT7
 OUT5  = buf5.BIT7
 OUT6  = buf6.BIT7
 OUT7  = buf7.BIT7
 OUT8  = buf8.BIT7
 OUT9  = buf9.BIT7
 OUT10 = buf10.BIT7
 OUT11 = buf11.BIT7
 OUT12 = buf12.BIT7
 OUT13 = buf13.BIT7
 OUT14 = buf14.BIT7
 PULSOUT Servo, buf15.BIT7            ' move the servo
   PAUSE 20                                    ' servo refresh delay

 GOTO Main


I appreciate any help that can be given.


http://www.vixenlights.com/

Gorak


Gorak

I have vixen lights controlling 5 LEDs (PWM) on my Arduino. If that helps you can read about it here.

Go Up