Search found 12 matches

by zz2633105
Thu Apr 27, 2017 10:34 pm
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

kwagyeman wrote:
Thu Apr 27, 2017 10:09 pm
Hi, can you edit your post and re-post your code using the tags? That way the formatting will not be removed.
Hi, I have solved this problem. How do I delete posts?
by zz2633105
Thu Apr 27, 2017 10:15 pm
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

kwagyeman wrote:
Thu Apr 27, 2017 10:09 pm
Hi, can you edit your post and re-post your code using the tags? That way the formatting will not be removed.
Thank you very much, I think I've learned.
by zz2633105
Thu Apr 27, 2017 9:53 pm
Forum: Technical Discussion
Topic: i2c in OpenMV3
Replies: 3
Views: 2203

Re: i2c in OpenMV3

QQ图片20170428095253.png
QQ图片20170428095253.png (110.7 KiB) Viewed 2200 times
by zz2633105
Thu Apr 27, 2017 9:47 pm
Forum: Technical Discussion
Topic: i2c in OpenMV3
Replies: 3
Views: 2203

Re: i2c in OpenMV3

pca9685.png
pca9685.png (196.68 KiB) Viewed 2201 times
by zz2633105
Thu Apr 27, 2017 9:46 pm
Forum: Technical Discussion
Topic: i2c in OpenMV3
Replies: 3
Views: 2203

i2c in OpenMV3

I connected PCA9685 servo module to openmv, and I found a bug. i2c in OpenMV2: >>>from pyb import I2C >>>i2c = I2C(2, I2C.MASTER) >>>i2c.scan() [64, 112] >>>i2c.mem_read(1,64,1) b'\x04' >>> i2c.mem_read(1,64,0) b'\x11' i2c in OpenMV3: >>>from pyb import I2C >>>i2c = I2C(2, I2C.MASTER) >>>i2c = I2C(2...
by zz2633105
Thu Apr 27, 2017 9:34 pm
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

Hi zz2633105, So, not trying to be mean here. But if you want an answer to your problems on the forums you need to structure your question in such a way that I can answer it. You just gave me a lot of code dump with no context. Can you please try to narrow down the exact line of code that has the i...
by zz2633105
Thu Apr 27, 2017 9:29 pm
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

deshipu wrote:
Thu Apr 27, 2017 3:18 pm
Ah, I see the problem. You are using i2c from pyb, while this library expects i2c from the machine module, which has a different API.
Can you give detailed advice?

Image
by zz2633105
Thu Apr 27, 2017 10:58 am
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

Is there an error in the I2C communication program call?
by zz2633105
Thu Apr 27, 2017 10:56 am
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

servoctrl.py: from pca9685 import PCA9685 import math class ServoCtrl( PCA9685 ): """ Servo Controleur - Allow you to control the servo 0 to 15 on the PCA9685 PWM Driver """ def __init__(self, i2c, address=0x80, freq=50, min_us=600, max_us=2400, degrees=180): PCA9685.__init__( self, i2c=i2c, address...
by zz2633105
Thu Apr 27, 2017 10:56 am
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

pca9685.py: import ustruct import time class PCA9685: def __init__(self, i2c, address=0x40): self.i2c = i2c self.address = address self.reset() def _write(self, address, value): self.i2c.mem_write(bytearray([value]), self.address, address ) def _read(self, address): return self.i2c.mem_read(1, self....
by zz2633105
Thu Apr 27, 2017 10:55 am
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

Re: I2C communication error

Code: Select all

main.py:

from pyb import I2C
import time
from servoctrl import ServoCtrl


i2c = I2C(2, I2C.MASTER) # The i2c bus must always be 2.

servos = ServoCtrl(i2c)

servos.position(0,90)
time.sleep(1000)
servos.position(0,0)
time.sleep(1000)
servos.position(0,90)
time.sleep(1000)
servos.position(0,0)
by zz2633105
Thu Apr 27, 2017 10:46 am
Forum: Technical Discussion
Topic: I2C communication error
Replies: 17
Views: 10835

I2C communication error

OpenMV3 and PCA9685 module communication errors

Go to advanced search