Search found 6 matches

by David128
Sun Apr 05, 2020 8:36 pm
Forum: Programs, Libraries and Tools
Topic: How to adapt a python library to micropython?
Replies: 11
Views: 10350

Re: How to adapt a python library to micropython?

Thanks for your help, yes I will read the documentation.
by David128
Sat Apr 04, 2020 6:17 pm
Forum: Programs, Libraries and Tools
Topic: How to adapt a python library to micropython?
Replies: 11
Views: 10350

Re: How to adapt a python library to micropython?

Thank you for your help Roberthh! I applied your code, but i have another error message. I despair a little. download ok exec(open('./cardio.py').read(),globals()) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 10, in <module> File "max30100.py", line 10...
by David128
Sat Apr 04, 2020 2:47 pm
Forum: Programs, Libraries and Tools
Topic: How to adapt a python library to micropython?
Replies: 11
Views: 10350

Re: How to adapt a python library to micropython?

In the library max30100 i replaced import smbus with: from machine import I2C, Pin When I run my test script ( cardio.py ), I get errors: import max30100 from machine import I2C, Pin from time import sleep i2c = I2C( sda=Pin(4), scl=Pin(2), freq=20000 ) mx30 = max30100.MAX30100(i2c) def cardio(): mx...
by David128
Sat Apr 04, 2020 10:56 am
Forum: Programs, Libraries and Tools
Topic: How to adapt a python library to micropython?
Replies: 11
Views: 10350

Re: How to adapt a python library to micropython?

Hello, I replaced the calls to i2c read_byte_data and write_byte_data to the matching calls of MicroPython, readfrom_mem and writeto_mem. I also replaced this: # Default to the standard I2C bus on Pi. #self.i2c = i2c if i2c else smbus.SMBus(1) # To Micropython self.i2c = i2c Is it correct? I'm not s...
by David128
Fri Apr 03, 2020 9:19 pm
Forum: Programs, Libraries and Tools
Topic: How to adapt a python library to micropython?
Replies: 11
Views: 10350

Re: How to adapt a python library to micropython?

Thank you for your information.
by David128
Fri Apr 03, 2020 6:52 pm
Forum: Programs, Libraries and Tools
Topic: How to adapt a python library to micropython?
Replies: 11
Views: 10350

How to adapt a python library to micropython?

Good morning all I am new to the forum. I am using Micropython on an ESP8266 and ESP32. I usually develop in Python. I have a question regarding micropython library. I'm looking for the "MAX30100" library on Micropython: I can't find it. It exists in Python: https://github.com/mfitzp/max30100 Can I ...