Skip to content

Instantly share code, notes, and snippets.

Created February 11, 2013 04:34
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import pyfirmata
print "maker1"
# Create a new board, specifying serial port
board = pyfirmata.Arduino('/dev/ttyACM0')
print "maker2"
# start an iterator thread so that serial buffer doesn't overflow
it = pyfirmata.util.Iterator(board)
print "maker3"
# set up pins
pin0=board.get_pin('a:0:i') # A0 Input (LM35)
pin3=board.get_pin('d:3:p') # D3 PWM Output (LED)
print "maker4"
# IMPORTANT! discard first reads until A0 gets something valid
while is None:
print "maker5"
while True :
print "PWM: " + str( )
board.pass_time(1) # pause 1 second
print "maker6"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment