EEVblog® Electronics Community Forum

Electronics => Microcontrollers => Topic started by: samdare on March 30, 2018, 09:25:46 pm

Title: Is there a way to program microcontroller with python code?
Post by: samdare on March 30, 2018, 09:25:46 pm
I am sort of good at python compared to C++,assembly and C and actually I love python compared to all other languages (no specific reason).So I just want to club python and embedded electronics is there a way that python hooks with microcontroller or vice versa :-D

Sent from my Lenovo K8 Plus using Tapatalk

Title: Re: Is there a way to program microcontroller with python code?
Post by: lgbeno on March 30, 2018, 09:28:49 pm
Yes https://learn.adafruit.com/welcome-to-circuitpython/what-is-circuitpython


Sent from my iPhone using Tapatalk Pro
Title: Re: Is there a way to program microcontroller with python code?
Post by: Jeroen3 on March 30, 2018, 09:30:46 pm
Unlikely. There are some projects doing javascript though.

In general, running an interpreted language on a microcontroller is highly inefficient. If interpreted languages are used, they are often limited to user programmable equations in larger programs. Eg: A PLC formula fields.

Just learn to type { and ; instead of [tab] and you'll be good to go!   :P
Title: Re: Is there a way to program microcontroller with python code?
Post by: samdare on March 30, 2018, 09:31:17 pm
Yes https://learn.adafruit.com/welcome-to-circuitpython/what-is-circuitpython


Sent from my iPhone using Tapatalk Pro
Just had a glance, looks cool ,thanks 

Sent from my Lenovo K8 Plus using Tapatalk

Title: Re: Is there a way to program microcontroller with python code?
Post by: samdare on March 30, 2018, 09:32:47 pm
Unlikely. There are some projects doing javascript though.

In general, running an interpreted language on a microcontroller is highly inefficient. If interpreted languages are used, they are often limited to user programmable equations in larger programs. Eg: A PLC formula fields.

Just learn to type { and ; instead of [tab] and you'll be good to go!   [emoji14]
[emoji23][emoji23][emoji23] quality humor.

Sent from my Lenovo K8 Plus using Tapatalk

Title: Re: Is there a way to program microcontroller with python code?
Post by: samdare on March 30, 2018, 09:35:35 pm
Unlikely. There are some projects doing javascript though.

In general, running an interpreted language on a microcontroller is highly inefficient. If interpreted languages are used, they are often limited to user programmable equations in larger programs. Eg: A PLC formula fields.

Just learn to type { and ; instead of [tab] and you'll be good to go!   [emoji14]
JavaScript!!,repository names?

Sent from my Lenovo K8 Plus using Tapatalk

Title: Re: Is there a way to program microcontroller with python code?
Post by: Jeroen3 on March 30, 2018, 10:06:00 pm
https://www.espruino.com/ (https://www.espruino.com/) is one of them.
Title: Re: Is there a way to program microcontroller with python code?
Post by: samdare on March 30, 2018, 10:10:12 pm
https://www.espruino.com/ (https://www.espruino.com/) is one of them.
Thanks

Sent from my Lenovo K8 Plus using Tapatalk

Title: Re: Is there a way to program microcontroller with python code?
Post by: abraxa on March 31, 2018, 08:01:59 am
There's also http://micropython.org/ (http://micropython.org/) - it's the foundation for the https://openmv.io/, (https://openmv.io/,) for example.
Title: Re: Is there a way to program microcontroller with python code?
Post by: samdare on March 31, 2018, 08:05:07 am
There's also http://micropython.org/ (http://micropython.org/) - it's the foundation for the https://openmv.io/, (https://openmv.io/,) for example.
The openmv site outdated ,404 error

Sent from my Lenovo K8 Plus using Tapatalk

Title: Re: Is there a way to program microcontroller with python code?
Post by: brtmr on March 31, 2018, 09:21:59 pm
This thing https://en.wikipedia.org/wiki/Micro_Bit (https://en.wikipedia.org/wiki/Micro_Bit) was handed to me at a Python conference last year. Developed for UK schoolkids to learn programming. Maybe it could also be for programmers who want to get started on microcontrollers?

Edit: This is the online IDE you can use:
http://python.microbit.org/v/1 (http://python.microbit.org/v/1)

Website IDE turns your Python code into a downloadable binary blob, you plug in your micro into your PC, it shows up as a hard drive, you copy the blob to the drive, done.
Title: Re: Is there a way to program microcontroller with python code?
Post by: igendel on March 31, 2018, 09:55:32 pm
As mentioned, there's CircuitPython and MicroPython, each with its "native" boards. The difference, to the best of my knowledge, is that MicroPython was optimized specifically for MCUs in some ways, while CircuitPython tries to stay true(r) to the original Python syntax.

Both are very limited. Obviously you can't just import any Python library, and what you do have will be slow and heavy on the microcontrollers' resources. I've done a couple of little demo projects on the BBC Micro:bit and a Pyboard clone from China. It's fun, arguably excellent for getting children interested in embedded/programming, but for more serious work you'll hit the limitations of these languages very fast.
Title: Re: Is there a way to program microcontroller with python code?
Post by: e100 on April 04, 2018, 09:53:32 am
As mentioned, there's CircuitPython and MicroPython, each with its "native" boards. The difference, to the best of my knowledge, is that MicroPython was optimized specifically for MCUs in some ways, while CircuitPython tries to stay true(r) to the original Python syntax.

CircuitPython = MicroPython + Adafruit's device drivers for talking to Adafruit developed hardware.
Title: Re: Is there a way to program microcontroller with python code?
Post by: e100 on April 04, 2018, 10:07:01 am
I am sort of good at python compared to C++,assembly and C and actually I love python compared to all other languages (no specific reason).So I just want to club python and embedded electronics is there a way that python hooks with microcontroller or vice versa :-D


Do a Google search for "micropython memory fragmentation" before going down this road.
If high reliability is important, then Python may not be the best solution.
Title: Re: Is there a way to program microcontroller with python code?
Post by: igendel on April 04, 2018, 10:31:22 am
CircuitPython = MicroPython + Adafruit's device drivers for talking to Adafruit developed hardware.

Ah, found it:
https://theamphour.com/383-an-interview-with-scott-shawcroft/
(from 28:00)