Hi all, I am quite new to Arduino and just purchased an AlaMode (shield?) with intentions to control a robot with python programming on the Pi.
I originally had trouble just getting a sketch to load to the AlaMode with the Arduino IDE and finally found that changing the 'board' info to show the correct baud rate fixed that problem. Blink works fine, so I then loaded the firmataStandard sketch sucessfully.
Then, using steps from a Middlesex University post on 'Raspberry Pi, Arduino and Firmata,' I wrote a simple program to blink another led (9) using the following simple python program:
#!/usr/bin/env python
#
import pyfirmata as pyf
PORT = '/dev/ttyACM0'
board = pyf.Arduino(9)
while 1:
board.digital[9].write (1)
board.pass_time(1)
board.digital[9].write (0)
board.pass_time(1)
The program waits for about 5 seconds and spits out the following error: ( I tried running it without the sudo first and got the same error.)
alamode/sketchbook $ sudo python firmata-tst.py
Traceback (most recent call last):
File "firmata-tst.py", line 27, in <module>
board = pyf.Arduino(9)
File "/usr/local/lib/python2.7/dist-packages/pyfirmata/__init__.py", line 16, in __init__
super(Arduino, self).__init__(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyfirmata/pyfirmata.py", line 75, in __init__
self.sp = serial.Serial(port, baudrate)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 260, in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 276, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port 9: [Errno 2] No such file or directory: '/dev/ttyS9'
Exception AttributeError: "'Arduino' object has no attribute 'digital'" in <bound method Arduino.__del__ of <pyfirmata.Arduino object at 0xb6c4a110>> ignored
Of course, I have no device '/dev/ttyS9', although I do have a '/dev/tty9' which is probably not the one this python script is looking for. I do have the device '/dev/ACM0', which is used by the IDE for serial communications.
Any ideas what I might be doing wrong here? Anybody familiar with the new AlaMode? Thanks Kem
