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’
Can you tell us a little more about your setup, which OS you are using. If are using an image other than Raspbian for Robots , how did you install the drivers for BrickPi. Also can you tell us what all you have tried with BrickPi.
Judging by the error you either don’t have the serial lines setup properly or you don’t have permission to use the serial lines. Are you using sudo when you run your program?
If you are using a Raspbian for Robots image as recommended by @karan and still getting the error, then can you follow this tutorial and update your software. Please click “Update Dexter Software” on the DI_Update GUI. After updating your software, try running the simplebot program and it should solve the problem.
If the problem still persists then send us a screenshot of the error and also tell us how you are running the example.
hello @Shoban i have updated my raspberry pi with the raspian for robots build now my all our codes disappeared in the process. I saw now that the codes for the simplebot on your website is gone. please help
Sorry to hear that you have lost your codes, I would suggest you to save your codes in a new folder different from the Dexter industries. So do not store any files inside any of the Dexter industries folder( GoPiGo, GrovePi, BrickPi+, etc…).
Regarding the code for Simplebot, the location of the file has been moved and it can be found here.
In your image it should be inside /home/pi/Dexter/BrickPi+/Software/BrickPi_Python/Project_Examples
@shoban hello we have got the robot to work now but can’t make changes to the code. when we do and save we get the permission denied error. Can we do something about it?
The os is blocking you because Dexter Ind doesn’t want accidently changes to the scripts. To fix that simply in the terminal type chmod +x Dexter/BrickPi+
Or if your using the pi3 chmod +x Dexter/BrickPi3
That should do it. However I recommend copying the code and changing the copy. Just make sure it is outside of the brickpi folder. Otherwise you’ll have to run chmod to do anything with it.