First, make sure that python2 or python3’s Adafruit_PCA9685 library has been downloaded. Then understand that the reason for this error is that Adafruit_PCA9685 could not find the external hardware, so think that you did not open I2C permissions (of course, make sure to open I2C permissions first), and then the error is usually in the following format
File "simpletest.py", line 17, in <module>
pwm = Adafruit_PCA9685.PCA9685()
File "/usr/local/lib/python3.7/dist-packages/Adafruit_PCA9685/PCA9685.py", line 81, in __init__
self._device.write8(MODE1, mode1)
File "/usr/local/lib/python3.7/dist-packages/Adafruit_GPIO/I2C.py", line 114, in write8
self._bus.write_byte_data(self._address, register, value)
File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 256, in write_byte_data
self._device.write(data)
IOError: [Errno 121] Remote I/O error
At this time we only need to click on the File "/ usr/local/lib/python3.7/dist - packages/Adafruit_PCA9685/PCA9685 py", line 81, in __init__ self. _device. Write8 (MODE1, MODE1) code> to enter to PCA9685. Py files, the need to look at the red circle place address, use the command line.
Open the command line for raspberry PI Type B input
sudo i2cdetect -y 1
Type A is A change to 0
appears
the 70 is gm's address, 41 is our module address some people is 20, or 40, and 0 d, and 3 c is my another equipment (raspberries pie intelligent housekeeper), if only to connect A device is good, look good, let's modify. Just open the PCA9685 py files address 0 x41 or 0 x40, etc., as the case may be, and then save the changes, then you will find
no permissions, so you can open A command line input
su
Enter the password, go to root, copy the address of pCA9685.py just now (mine is 0x41), type CD and address, paste it to the command line, press enter, and go to that directory.
if you are a python3.7 user you can use this one directly
cd /usr/local/lib/python3.7/dist-packages/Adafruit_PCA9685/
Py sudo chmod 777 pca9685.py
modify permission
then edit the pca9685.py file just now, modify the PCA9685_ADDRESS in it to the address you found by using sudo i2cdetect -y 1.
then run it and try it!
Read More:
- Raspberry pie upgrade to Python 3.7.3
- How to login raspberry pie
- Solution of apt unable to update in the docker container of raspberry pie
- Raspberry pie set up to run Python program automatically
- Several ways to check the IP address of raspberry pie
- Raspberry pie startup self startup opencv program script and error analysis
- Raspberry pie view IP address (command ifconfig) and exit Ping
- Ioerror: [errno 13] permission denied
- Solve the problem of raspberry pie using GStreamer. Importerror: cannot import name XXX introspection typelib not found
- Error: Command ‘arm linux gnueabihf GCC’ failed with exit status 1, raspberry pie install paramiko
- A method to solve the error – 110 whilst initializing SD card of raspberry pie
- Troubleshooting of “disk I / O error” after startup
- Disk BLK_ update_ request: I/O error
- An I/O operation initiated by the Registry failed unrecoverably
- Resourceaccessexception: I / O error on post request for and connection timed out
- coredns [ERROR] plugin/errors: 2 read udp : i/o timeout
- Python read / write file error valueerror: I/O operation on closed file
- Navicat remote connection SQL Server 2014 express report 08001 error
- The first time I write OpenGL program, what should I do when I encounter “can’t open include file:” GL / glaux. H “: no such file or directory”?
- Sqlog connect to MySQL 8.0.24 remote server, error: 2058 solution