Commits

Fabian Affolter  committed 231391c

Some more comments

  • Participants
  • Parent commits 96116e8

Comments (0)

Files changed (1)

File examples/dimmer.py

 
 import pyfirmata
 
+PORT = '/dev/ttyACM0'
+
 # Time (approx. seconds) to get to the maximum/minimum
 DURATION = 5
 # Numbers of steps to get to the maximum/minimum
 STEPS = 10 
 
-# Adjust that the port match your system, see samples below:
-# On Linux: /dev/tty.usbserial-A6008rIF, /dev/ttyACM0, 
-# On Windows: \\.\COM1, \\.\COM2
-PORT = '/dev/ttyACM0'
-
-# Creates a new board 
+# Creates a new board and define the pin
 board = pyfirmata.Arduino(PORT)
-print "Setting up the connection to the board ..."
-
-# Definition of the pin, one with PWM, marked as ~XX on the Arduino
+# Pin use one that supoorts ~ (PWM) (e.g. 3, 5, 6, 9, 10, or 11)
 digital_0 = board.get_pin('d:11:p')
 
 # Waiting time between the 
 wait_time = DURATION/float(STEPS)
 
-# Note: Value range for PWM is 0.0 till 1.0
-
 # Up
 for i in range(1, STEPS + 1):
     value = i/float(STEPS)