i use python 2.7, NOOBS card and rpi revision B.
the script:
the error:import serial
#import time
serialport = serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5)
position1 = "#0 P1500 # 1 P1500 T 1000 <cr>"
position2 = "#0 P1000 # 1 P1000 T 1000 <cr>"
def move():
serialport.write("#0 P1500 # 1 P1500 T 1000 <cr>")
Print ("move at 1500")
delay(1000)
#time.sleep(1) #sleep 1000mS
serialport.write("#0 P1000 # 1 P1000 T 1000 <cr>")
Print ("move at 1500")
delay(1000)
#time.sleep(1) #sleep 1000mS
Print ("moves done")
choice = raw_input('do again ? [y/n]')
if choice == "y":
move()
elif choice == "n":
sys.exit(0)
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "/home/pi/test fred 28 05 2014.py", line 4, in <module>
serialport = serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5)
File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 282, in __init__
self.open()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 289, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
OSError: [Errno 13] Permission denied: '/dev/ttyAMA0'
>>>