kevinmcaleer / pca9685_for_pico

MIT License
19 stars 6 forks source link

Memory writing issue #2

Open JTPernu opened 1 year ago

JTPernu commented 1 year ago

There's an issue with writing to memory, it seems. Gives this error comand, even with the demo:

Traceback (most recent call last): File "", line 11, in File "/lib/pca9685_for_pico/pca9685.py", line 29, in init File "/lib/pca9685_for_pico/pca9685.py", line 39, in reset File "/lib/pca9685_for_pico/pca9685.py", line 32, in _write OSError: [Errno 5] EIO

thethoughtfulinventor commented 1 year ago

Have you found a soluton to this? I am also having the same issue.

gokul6350 commented 1 year ago

yaaa me too

gokul6350 commented 1 year ago

Have you found a soluton to this? I am also having the same issue.

have you found it works some but doesn't work some times .

thethoughtfulinventor commented 1 year ago

I have found a solution. the code is a few years out of date, so one of the things you need to do is replace all the Pin() lines with machine.Pin(). this fixed the error for me, however you do need to make sure that your i2c device is connected to the pins you set in the code.

thethoughtfulinventor commented 1 year ago

having said that, i am now getting an error saying that the Servos commands arent there.

JTPernu commented 1 year ago

replace all Pin() lines with machine.Pin()

This shouldn't actually make a difference. At least the current file imports machine.Pin() in a way, that just saying Pin() includes the library already: from machine import I2C, Pin

JTPernu commented 1 year ago

Have you found a soluton to this? I am also having the same issue.

I have, I guess. It's a fiddly thing, it looks like, but the problem can be solved by rebooting the pico, I think. Or reconnect to it. I haven't a clue how, but I did get it to work with that. But do make sure to fix the import statement from Servo.py.

gokul6350 commented 1 year ago

your

Have you found a soluton to this? I am also having the same issue.

I have, I guess. It's a fiddly thing, it looks like, but the problem can be solved by rebooting the pico, I think. Or reconnect to it. I haven't a clue how, but I did get it to work with that. But do make sure to fix the import statement from Servo.py.

can i get your discord

thethoughtfulinventor commented 1 year ago

i have gotten everything working now, i just needed to restart the pico, however its not moving the motors.

thethoughtfulinventor commented 1 year ago

your

Have you found a soluton to this? I am also having the same issue.

I have, I guess. It's a fiddly thing, it looks like, but the problem can be solved by rebooting the pico, I think. Or reconnect to it. I haven't a clue how, but I did get it to work with that. But do make sure to fix the import statement from Servo.py.

can i get your discord

is this to me or them?

JTPernu commented 1 year ago

your

Have you found a soluton to this? I am also having the same issue.

I have, I guess. It's a fiddly thing, it looks like, but the problem can be solved by rebooting the pico, I think. Or reconnect to it. I haven't a clue how, but I did get it to work with that. But do make sure to fix the import statement from Servo.py.

can i get your discord

If you mean me, mind if I ask why?

JTPernu commented 1 year ago

i have gotten everything working now, i just needed to restart the pico, however its not moving the motors.

Does it give you any error message? Or is it just not moving? If the former, please show us the message, if the latter, please show the code. I can try and help you solve it, if you need help

thethoughtfulinventor commented 1 year ago

this is all the code in the main.py:

from pca9685 import PCA9685

from picocat import Servos

from machine import I2C, Pin from servo import Servos sda = machine.Pin(4) scl = machine.Pin(5)

i2c = I2C(0, sda=sda, scl=scl)

pca = PCA9685(i2c=i2c)

pca.i2c = i2c

servo = Servos(i2c=i2c) servo.position(index=0, degrees=180)

thethoughtfulinventor commented 1 year ago

idk why it formatted like that tho

JTPernu commented 1 year ago

this is all the code in the main.py: #from pca9685 import PCA9685

from picocat import Servos

from machine import I2C, Pin from servo import Servos sda = machine.Pin(4) scl = machine.Pin(5)

i2c = I2C(0, sda=sda, scl=scl)

pca = PCA9685(i2c=i2c)

pca.i2c = i2c

servo = Servos(i2c=i2c) servo.position(index=0, degrees=180)

Hmmmm... Looks like you're putting the pca.py into comments, so that might be it. And pca=PCA9685(i2c=i2c) is commented too.

Bet beyond that, you can always scan four i2c, if the code finds the device at all: devices = i2c.scan( if len(devices) != 0: print('Number of I2C devices found=',len(devices)) for device in devices: print("Device Hexadecimel Address= ",hex(device)) print() else: print("No I2C device found")

If you want, here's my test code. You can try with that. I use different pins and file name, so do change those in the code before trying.

Code Snip

gokul6350 commented 1 year ago

i have gotten everything working now, i just needed to restart the pico, ho

because its hard to talk here it will better if we discuss there

gokul6350 commented 1 year ago

any permanent way to fix the error @JTPernu @thethoughtfulinventor
Gokul#9638 - Discord

thethoughtfulinventor commented 1 year ago

maybe, i wont know untill friday or monday tho. i let out the magic smoke by accident

thethoughtfulinventor commented 1 year ago

any permanent way to fix the error @JTPernu @thethoughtfulinventor Gokul#9638 - Discord

welp, i just installed the program on the new pico, and it works just fine. my guess is that you guys need to reintall micropython on your bords.