0

I know that I can program Arduino with python but is it possible to make every project, which can be completed by normal IDE?

9
  • 2
    How do you "know" that you can program an Arduino "with" Python? Jan 3, 2015 at 18:07
  • 1
    possible duplicate of Programming an Arduino using Python, rather than C/C++
    – jfpoilpret
    Jan 3, 2015 at 18:14
  • 1
    Do yourself a favor and learn C/C++. You won't regret it.
    – PhillyNJ
    Jan 3, 2015 at 23:59
  • 3
    "You won't regret it" is a bit optimistic. Especially on those long, cold nights when the memory allocator in your templated class goes tits-up. You'll definitely regret it then. But it will still be the best choice for developing on the Arduino. Jan 4, 2015 at 0:13
  • 1
    @PhilVallone: I was being facetious :P Jan 4, 2015 at 3:53

3 Answers 3

3

I imagine you want to use python because you are already familiar with it, know your way around the syntax, etc. But I would advice against this line of thinking, because microcontrollers need a little more of "low-level" thinking (given the limited resources they generally have) and because of that, it's probably best if you learn some C/C++.

The arduino programming framework provides some not-so-low-level libraries and tools (like the arduino IDE itself) to make it easy for non-C programmers to learn C-like programming.

However, if you want to use python as a proof of concept or anything else, sorry about the misunderstanding! :)

1

The direct answer is almost certainly not.

There are some auspicious developments so that you might be able to adapt a specific open source Python package, but the resulting software would require a special Arduino board with an MCU chip with much more SRAM and a higher clock speed than we usually see on Arduino boards.

Discussion

I have looked several times and have never found anything.

I did find a "stripped down" implementation of a Python 3.3 interpreter called Micro Python. The software was developed hand in hand with MicroPy, an ARM-based single board computer (also described at the MicroPython website). MicroPy is closer to a Raspberry Pi or Beaglebone than an Arduino. However, the software environment is less complex because the MicroPy doesn't require a Linux-based or other operating system.

The base Micro Python package software package seems to require about 110KB of SRAM to boot up and expects a 1 MB SD chip with a boot record and MicroPython on it.

The Micro Python software was released under the MIT open source license so, in theory, a clever person could adapt it for the Arduino if they built a board with a really powerful chip SD socket.

Although the Micro Python/MicroPy package is very appealing, I don't think I would head down the path. I would rather be programming for hardware that is available from more than one source.

Another potential issue is that the Micro Python implementation uses a mark and sweep garbage collector which might tie up the processor for 4 msec at time. Depending on your application a 4 msec busy period might not be acceptable.

0

Not really, since python is an interpreted programming language. If you are not new to the microcontrollers' world and have same experience, maybe this Board is you what you want. More powerful than Arduino and completely programble using Python 3.

Topic: Can I use Python to program Arduino?

12
  • The fact that Python is interpreted (or more accurately, byte-compiled for a VM) is not actually relevant. There are several Python VMs for AVR and ARM. Jan 3, 2015 at 22:22
  • Not exactly. micro controllers, by virtue of not having an os, can only execute compiled code. Hence, using Python is not good as you'll run into a lot of runtime errors and stuff that can be figured out when compiling (exact memory allocation). C++ is better suited.
    – xyz
    Jan 4, 2015 at 11:40
  • 2
    That's a silly thing to say. Not having an OS means that os and sys are less useful, but an allocator is by no means dependent on an OS. And assuming a working VM implementation, there's little to no reason why a Python program should be any more or less difficult to debug than a C++ application (other than the absence of e.g. debugWire, which can be emulated at a higher level regardless). Jan 4, 2015 at 17:07
  • @prakharsingh95 Yes, they can only execute compiled code. The compiled code is the interpreter. Jan 4, 2015 at 20:09
  • @AnnonomusPenguin, an interpreter is the main executing instance which executes Python code. Compiled code allows static scheduling, and memory management, interpreted code will have a harder time optimising. Python programs would need to be internally compiled to byte code , against pythons nature, or the program would need to an interpreter, like you said, which will kill performance. But of course, c++ here makes sense to me, but Python might be feasible.
    – xyz
    Jan 4, 2015 at 20:16

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