Basic Arduino to Maya III
July 28th, 2009Baby steps while I bonk my head against the Maya API:
Code follows:
The Arduino code and board setup are the same as in yesterday’s post. The Python is only very slightly different, but in a very satisfying way.
Maya Python code:
### simple button read 2 sys.path.append( "C:\Program Files\Common Files\Python\Python25\Lib\site-packages\win32") sys.path.append( "C:\Program Files\Common Files\Python\Python25\Lib\site-packages\win32\lib") import time, sys, serial, win32file, win32con import maya.cmds as cmds ser = serial.Serial( port='COM3', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS ) start=timerX() totalTime = timerX(startTime=start) mySphere = sphere()[0] while totalTime < 5: myInput = ser.read() print myInput myScale = int(myInput)+1 mySphere.scale.set(myScale, myScale, myScale) totalTime = timerX(startTime=start) refresh() ser.close() delete(mySphere) ###« previously: Basic Arduino to Maya II | Home | next: Basic Arduino to Maya Mocap »