lsof /dev/ttyS0
sudo apt-get install lsof
Statistics: Posted by Alan — Wed Jan 28, 2015 12:15 am
Statistics: Posted by Alan — Tue Jan 27, 2015 11:35 am
Statistics: Posted by Maximus789 — Mon Jan 26, 2015 10:11 pm
Statistics: Posted by Alan — Tue Dec 30, 2014 10:52 pm
sudo python filename.py
import time
from PyMata.pymata import PyMata
import RPi.GPIO as GPIO
# Set co-op pins
BOARD_LED = 13
POTENTIOMETER = 0
# Creat a PyMata instance using the Arduino COM Port as the input parameter
SERIAL_PORT = "/dev/ttyS0"
firmata = PyMata( SERIAL_PORT, max_wait_time=5 )
# set digital pin 13 to be an output port
firmata.set_pin_mode(BOARD_LED, firmata.OUTPUT, firmata.DIGITAL)
firmata.set_pin_mode(POTENTIOMETER, firmata.INPUT, firmata.ANALOG)
sensorvalue = firmata.analog_read(POTENTIOMETER)
#Set GPIO pins
GPIO.setmode(GPIO.BOARD)
GPIO.setup(8,GPIO.OUT)
#read anologue input
print "Blinking LED 13 10 times"
print firmata.analog_read(POTENTIOMETER)
print sensorvalue
#if sensorvalue<500:
# for i in range(0,10):
# print '< 500'
# print "iteration " + str(i+1)
# GPIO.output(8,True)
# print 'high'
# time.sleep(0.05)
# GPIO.output(8,False)
# print 'low'
# time.sleep(0.05)
# blink for 50 times
for x in range(20):
print x+1
print firmata.analog_read(POTENTIOMETER)
firmata.digital_write(BOARD_LED, 1)
# wait a half second between toggles.
time.sleep(.5)
firmata.digital_write(BOARD_LED, 0)
time.sleep(.5)
# close PyMata when we are done
GPIO.cleanup()
firmata.close()
Opening Arduino Serial port /dev/ttyS0
Please wait while Arduino is being detected. This can take up to 5 seconds ...
Error: Caught exception in command handler - pop from an empty deque
Board Auto Discovery Failed!
Traceback (most recent call last):
File "pymata_anologue.py", line 13, in <module>
firmata = PyMata( SERIAL_PORT, max_wait_time=5 )
File "/usr/local/lib/python2.7/dist-packages/PyMata/pymata.py", line 148, in __init__
raise Exception( "Unable to connect to Firmata" )
Exception: Unable to connect to Firmata
Statistics: Posted by Maximus789 — Mon Dec 29, 2014 4:03 pm
Statistics: Posted by Alan — Mon Dec 29, 2014 3:46 pm
import time
from PyMata.pymata import PyMata
#import RPi.GPIO as GPIO
#Set GPIO pins
#GPIO.setmode(GPIO.BOARD)
#GPIO.setup(8,GPIO.OUT)
# Set co-op pins
BOARD_LED = 13
POTENTIOMETER = 0
# Creat a PyMata instance using the Arduino COM Port as the input parameter
SERIAL_PORT = "/dev/ttyS0"
firmata = PyMata( SERIAL_PORT, max_wait_time=5 )
# set digital pin 13 to be an output port
firmata.set_pin_mode(BOARD_LED, firmata.OUTPUT, firmata.DIGITAL)
firmata.set_pin_mode(POTENTIOMETER, firmata.INPUT, firmata.ANALOG)
sensorvalue = firmata.analog_read(POTENTIOMETER)
#read anologue input
print "Blinking LED 13 10 times"
print firmata.analog_read(POTENTIOMETER)
#if sensorvalue<500:
# for i in range(0,10):
# print '< 500'
# print "iteration " + str(i+1)
# GPIO.output(8,True)
# print 'high'
# time.sleep(0.05)
# GPIO.output(8,False)
# print 'low'
# time.sleep(0.05)
# blink for 50 times
for x in range(50):
print x+1
print firmata.analog_read(POTENTIOMETER)
firmata.digital_write(BOARD_LED, 1)
# wait a half second between toggles.
time.sleep(.5)
firmata.digital_write(BOARD_LED, 0)
time.sleep(.5)
# close PyMata when we are done
firmata.close()
Statistics: Posted by Maximus789 — Mon Dec 29, 2014 3:27 pm
ps aux | grep python
sudo kill -9 PID
Statistics: Posted by Alan — Mon Dec 29, 2014 1:24 pm
Statistics: Posted by Maximus789 — Mon Dec 29, 2014 11:22 am
Statistics: Posted by Alan — Mon Jun 23, 2014 12:21 pm
Statistics: Posted by arnoldbail — Mon Jun 23, 2014 11:35 am
Statistics: Posted by Alan — Sat Jun 21, 2014 11:45 am
Statistics: Posted by arnoldbail — Fri Jun 20, 2014 11:49 am