View Single Post
  #2  
Old 07-07-2003, 10:29 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

To get data from the serial port within your script you will want to create a Sensor Plug-in. You will need to program in C/C++. If you are interested in this we can give you the appropriate header files and an example.

Vizard supports joysticks through a library called sid. You would probably want to create a timer that checks the current state of the joystick and updates the view. Here's is some sample code for using the joystick.

Code:
import sid
.
.
.

def mytimer(num):

    buttons = sid.buttons()
    if buttons & 1:
        print 'Button 1 is down'
    if buttons & 2:
        print 'Button 2 is down'
    if buttons & 4:
        print 'Button 3 is down'
    

    data = sid.get()
    print 'X axis of joystick at', data[0]
    print 'Y axis of joystick at', data[1]

    slider = sid.slider()
    print 'Joystick slider at', slider
If you have any more questions I'll be happy to help you.
Reply With Quote