Using micropython with arduino core

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
amigoDupanez
Posts: 2
Joined: Fri Aug 04, 2017 10:44 am

Using micropython with arduino core

Post by amigoDupanez » Fri Aug 04, 2017 10:48 am

Is it possible to write a program in arduino core and have micropython at the same time? I want to have a scripting language, but can't write it entirely in python due to a bad performance. I know that I can embed C code in micropython, but can I use arduino libraries there?

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Using micropython with arduino core

Post by SpotlightKid » Fri Aug 04, 2017 10:30 pm

There's a relatively new project to embed micropython into mbed-os. I find the mbed API and overall environmnet much more appealing than the Arduino one.

https://developer.mbed.org/users/infinn ... icropython

User avatar
dbc
Posts: 89
Joined: Fri Aug 28, 2015 11:02 pm
Location: Sunnyvale, CA

Re: Using micropython with arduino core

Post by dbc » Fri Aug 04, 2017 11:40 pm

Have you looked at the @micropython.native and @micropython.viper decorators?

amigoDupanez
Posts: 2
Joined: Fri Aug 04, 2017 10:44 am

Re: Using micropython with arduino core

Post by amigoDupanez » Sat Aug 05, 2017 10:14 am

@micropython.native does not work on ESP32
The library I want to use is https://github.com/Bodmer/TFT_eSPI It works on Arduino. I don't want any other library since only this one gives the performance I want. Porting it is out of my skills ;/

Can't I put this library and arduino core for ESP32 together in stmhal?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Using micropython with arduino core

Post by pythoncoder » Sun Aug 06, 2017 4:10 pm

Firstly stmhal is the branch for STM processors such as the Pyboard. It is irrelevant to the ESP32 which has a different processor architecture (Espressif).

There are two approaches which could be used, but both require some expertise. The approach I would use is to port the code to Python. If you can read C and write Python porting is straightforward donkey work.

The C code could in principle be ported so that it appeared as a native MicroPython module. In my opinion that would be more difficult, but that could reflect my own language preference. I think others will probably agree that with a library of that size it would require good C skills and an understanding of writing C modules for MicroPython. There is a fair amount of information on the latter topic in here.

The easy solution is to use a display where the donkey work has been done, for example the official LCD160CR module. Or search in here and in the Wiki for display drivers. There are quite a few...
Peter Hinch
Index to my micropython libraries.

Post Reply