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.

migrated from electronics.stackexchange.com May 31 at 11:41

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 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 May 31 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 May 31 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 May 31 at 14:18
  • @Gerben Do you know some examples ? – Amine Messaoudi Jun 3 at 9:33
  • 2
    Their website has whole range of board that run their version of microPython. See adafruit.com/circuitpython – Gerben Jun 3 at 14:03
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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