Simple bot motor "syntax error" please help[SOLVED]

i am building a simplebot for a school project and im getting syntax error in the python code. the code is from the simplebot motor code for the keyboard keys. please help

@brynjar: can you post a screenshot of the error you are getting and a link to the program you are trying to run. Are you using Dexter Industries raspbian for Robot image or some other image.

im trying to use this https://github.com/DexterInd/BrickPi_Python/blob/master/Project_Examples/simplebot/simplebot_psp.py

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 275, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: ‘/dev/ttyAMA0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/motor code simple.py”, line 47, in
BrickPiSetup() # setup the serial port for communication
File “/home/pi/BrickPi.py”, line 690, in BrickPiSetup
ser.open()
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 278, in open
raise SerialException(“could not open port %s: %s” % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/ttyAMA0: [Errno 13] Permission denied: ‘/dev/ttyAMA0’

@karan

Which image are you using, is it our Raspbian for Robots image. It might be easier to get started with it. The instructions are here.

If you are using your own image, did you follow the guidelines to install BrickPi python lib here.

i typed in sudo apt-get update and sudo apt-get upgrade in the run field but nothing is happening :stuck_out_tongue: @karan
yes i am connected to the internet on the raspberry pi

@brynjar: Can you try using our image from the link above and send a few screenshots of the problem you are getting.

i managed to install them. will let you know if we bump into more problems thanks. @karan

This topic was automatically closed after 24 hours. New replies are no longer allowed.