I2C interface
-
I'm currently use the differential pressure sensor D6F-PH from OMRON with my LOPY. Unfortunatly It seems there's no driver for this sensor. And the data sheet seems indistinct for this purpose.
any help ? -
@epage said in I2C interface:
D6F-PH
it is i2c based and because of that it is simple to use
https://www.omron.com/ecb/products/sensor/special/mems/pdf/AN-D6F-PH-01EN_r1.pdf
look into this threadhttps://forum.arduino.cc/index.php?topic=285116.0
you must only convert code to micropython which is also quite simple
https://docs.pycom.io/pycom_esp32/library/machine.I2C.htmland real sample
https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/i2c.html -
Thanks a lot ... but
my initialization code for instance based on ARDUINO example :def initialize ():
#INITIALIZATION AFTER POWER UP i2c = I2C(0, I2C.MASTER) # create and init as a master #i2c.init(I2C.MASTER) # configure the I2C bus i2c.init(I2C.MASTER, baudrate=400000) # init as a master i2c.writeto(0x6C, 0x0B) i2c.writeto(0x6C, 0x00) print ("Initialization done: ")give me :
TypeError: object with buffer protocol required for this line :
i2c.writeto(0x6C, 0x0B)
I don't understand.. what's the correct instruction ?
Thanks for help -
@epage
you must pass bytesi2c.writeto(0x6C, bytes([0x0B])) -
Thanks a lot !
Now I must translate ARDUINO code
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login