1 import serial 2 # find your own usb serial port by "ls /dev" and note I changed the Firmata on my Arduino to use 9600 bps 3 ser=serial.Serial('/dev/ttyUSB0',9600,timeout=1) 4 # 0x91 is the digital write message (0x90) + "port" 1 (on larger board, there might be more ports), the second two bytes are a bitmask of the digital I/O pins in terms of if they should be on or off 5 # turn on all digital outputs 6 ser.write(chr(0x91)+chr(0x7F)+chr(0x7F)) 7 # turn off all digital outputs 8 ser.write(chr(0x91)+chr(0x00)+chr(0x00))