1

I've been using Python for quite long, and I was wondering if it can be used as a programming language for Arduino, rather than C/C++.

When I'm using the Arduino IDE, the sketch is compiled into a hex file that contains the program binary.

enter image description here

enter image description here

Knowing that micro controllers execute only binary, I would like to know if there is a tool to convert Python code into binary, so that I can upload it directly to Arduino using AVR or other programmers.

I read about Micro Python, a lightweight adaptation of Python that can fit in boards, but can only work with PyBoard, which I have never used yet.

I believe that Arduino manufacturers should start developing boards that can run Python, because it's very simple to use, unlike C/C++. It also has a lot of builtin modules that can make development very easy, which will achieve a remarkable progress in IOT.

5
  • Python is an interpreted language with a lot of libraries. You would need either an interpreter squeezed into the Arduino, or a compiler that makes assembly code from Python (maybe by way of C.) Too much hassle for too little gain.
    – JRE
    Commented May 31, 2019 at 11:40
  • And I say that as someone who uses Python extensively in personal projects. I like Python - but not on my Arduino
    – JRE
    Commented May 31, 2019 at 11:41
  • 2
    Adafruit has a few boards that run microPython. As far as I know, those will interpret code, so don't require precompiled binaries.
    – Gerben
    Commented May 31, 2019 at 14:18
  • @Gerben Do you know some examples ? Commented Jun 3, 2019 at 9:33
  • 2
    Their website has whole range of board that run their version of microPython. See adafruit.com/circuitpython
    – Gerben
    Commented Jun 3, 2019 at 14:03

1 Answer 1

2

To my knowledge, there is not a "python to ATMega architecture" compiler out there.

However, it's not true that MicroPython only runs on PyBoard. There are versions for installation also on the ESP8266 and ESP32 chips, and so the popular NodeMCU and Wemos D1 development boards, or any of the other similar products with those processors, can easily run Python code. Many of these are available at a very low cost from the usual retailers/sources.

Be aware that MicroPython is somewhat limited compared to the full version due to the limited RAM available on these boards.

2
  • Can the arduino mega run Python ? Commented May 31, 2019 at 13:13
  • 2
    The GitHub repo, ports directory, indicates no support for ATMega processors, which is what is in an Arduino Mega. Commented May 31, 2019 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.