![]()  | 
	
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
				
				pyserial + vizard
			 
			
			
			Hi all, 
		
		
		
		
		
		
		
		
	
	I'm wondering if somebody can help me with a communication problem I have with a hardwareDevice connected to my serial port. We would like to connect a bike to Vizard and use the cycleData to control the camera. (we already have the protocol information and we are able to print correct data in Delphi) I found the pyserial recommendation in the Worldviz-Knowledgebase. But I can't get it to work properly. When I try to print x nothing happens. Does anybody have experience with pySerial in Vizard. Thank you so much! Code: 
	import serial 
import viztask
viz.go()
#hex(255)[2:] = ff
#int('ff',16) = 255
start_flag = int('F1',16)
stop_flag = int('F2',16)
cmdGetSpeed = int('A5',16)
cmdSetGear = int('2D',16)
ser = serial.Serial(
     port=0,
     parity=serial.PARITY_NONE,
     bytesize=serial.EIGHTBITS,
     stopbits=serial.STOPBITS_ONE,
     timeout=0,
     xonxoff=0,
     rtscts=0,
     baudrate=9600
   )
def mykeyboard(key):
	if key == "s" :
		viztask.schedule(serialComTask())
def serialComTask() :
	ser.write(start_flag)
	ser.write(cmdGetSpeed)
	ser.write(cmdGetSpeed)
	ser.write(stop_flag)
	print "sended"
	yield viztask.waitTime(2)
	print "waited 1 sec"
	x = ser.read(4) 
	print x
def onExit():
	print "quiting"
	ser.close() 			# close port
	pass
viz.callback(viz.KEYBOARD_EVENT,mykeyboard)
viz.callback(viz.EXIT_EVENT,onExit)
 | 
		
  | 
	
		
  | 
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Realistic Light and Shadows Using Vizard and 3DS Max | jde | Vizard | 4 | 07-13-2012 11:58 AM | 
| .3DS importing in Vizard and 3D Studio | jde | Vizard | 1 | 08-28-2009 04:14 PM | 
| Vizard tech tip: Using the Python Imaging Library (PIL) | Jeff | Vizard | 0 | 03-23-2009 12:13 PM | 
| Vizard tech tip: Text to Speech | Jeff | Vizard | 1 | 01-15-2009 10:39 PM | 
| Fall 2007 release of Vizard R3 | 3 D | Announcements | 0 | 10-15-2007 05:50 PM |