Python for Arduino Due

Is it possible to program the Due in python? Or pymite as attempted on the Maple board (leaflabs.com)?

Let's face it, python is arguably the most popular programming language today and much easier to program than C, especially for matrix operations. It's close to Matlab code and Octave. It's arguably becoming a First language of choice.

Before someone suggests the Raspberrypi, I should say I find its minimal GPIOs, incomplete libraries and missing ADCs disappointing. Plus you have to purchase a monitor, keyboard, mouse, etc. to interact with it, so it turns out that a cheaper option is to go with a netbook or used laptop. Raspberrypi is an exercise in hype.

Has Arduino thought about shifting away from C and toward Python?

Python is a scripting language... No.

python is arguably the most popular programming language today

In terms of popularity, Python is generally well behind C/C++. If you really wanted to move to a partially-compiled bytecode virtual machine type language, Java is generally more popular than Python.

http://langpop.com/

There's really no hard boundary between 'scripting' and 'programming' languages, and python certainly has other uses than scripting. Personally I'm sure that python will find its way to the Arduino world and have its place, just as it has with .NET. There's too much goodness now in the 'py world' for this not to happen.

People always worry about scripting performance, but the worry tends to go away over time - most folk don't have to worry any more about JIT compilation and the like with Java and the .NET languages. Obviously you wouldn't want to use an interpreted language for device control, tight timing loops and interrupt routines, but for higher layers it could be very useful if there's room for the (normally) C-based engine.

http://wiki.python.org/moin/EmbeddedPython
http://wiki.python.org/moin/PyMite

Jim

Let's face it, python is arguably the most popular programming language today and much easier to program than C, especially for matrix operations.

Three points made and all wrong!

I have recently had to learn python and I am not at all impressed. For example there is no way of having more than one static variable in a function. What sort of a language is that!

If pymite runs on a Maple, it should run on a Due as well.
Interpreters tend to prefer systems with lots of RAM. The pymite docs say that it loads the user program into RAM before running it. This means that your python code would need to be smaller than the maximum sized C program. (OTOH, it looks like you could store more than one python program in flash and chain them.)
That's if you're happy with Pymite. It looks a bit complicated to actually use...

For anybody interested, there's a very interesting use of Python 'close to the metal' at:

http://www.eetimes.com/electronics-blogs/maxs-cool-beans-blog/4217647/IPv4--IPv6--The-Internet-of-Things--6LoWPAN--and-lots-of-other--Stuff- (see the bit about 'SNAPpy')

Jim

randomvibe:
Has Arduino thought about shifting away from C and toward Python?

Shifting away from C would be a crazy idea. But adding Python support while still fully supporting C could increase applications and target audience.

C and Python have different strengths, so having access to both can only result in more strength for the Arduino community.

As an example I live in Australia with a child in school and the National Computing initiatives for schools is about programming in Python. This means getting Arduino into schools is much more difficult without Python support. There are many case where adding Python could increase the community. However the idea of reducing C support is crazy as the whole idea would be increase the coommunity- not alienate the existing community.

So idea- add Python support- but in no way detract from C support.

If anything, an increased community should have even more C support!

As I understand it the benefit of pyhton is the ability to process text strings.
So for interfacing over USB to an instrument or external module there would be an easier capability to manage the input and output.
However, I don't think it replaces C++. The C++ is the machine control environment and implement the drivers and management.
So the down side is more resources - ram and flash.

So idea- add Python support- but in no way detract from C support.

Very easy to say, very hard to implement.

neil12:
As I understand it the benefit of pyhton is the ability to process text strings.
So for interfacing over USB to an instrument or external module there would be an easier capability to manage the input and output.
However, I don't think it replaces C++. The C++ is the machine control environment and implement the drivers and management.
So the down side is more resources - ram and flash.

Actually it has many benefits - plus many limitations, particularly in being close to the hardware etc.
That is why the best solution can sometimes be a combination of Python and C/C++.

Grumpy_Mike:

So idea- add Python support- but in no way detract from C support.

Very easy to say, very hard to implement.

Perhaps if a forum was created to share ideas on Python implementation on the Due it could be a start?

Over time some probably would have to appear as leaders who know Arduino and Python well (unlike me). But if people post about the way they bring Python to the Due favorite techniques might start to emerge.

And a few years after the previous post...

Python runs on the Arduino Due thanks to MicroPython and Simba!

Try it out!

http://forum.arduino.cc/index.php?topic=424405.0

Hi guys,
there's also another solution: Zerynth - Python for Microcontrollers, IoT and Embedded

The core of Zerynth is the Zerynth Virtual Machine. The Zerynth VM has been developed from scratch with the goal of bringing Python to the embedded world with support for multi-thread and cross board compatibility.

Zerynth supports all the most used high-level features of Python like modules, classes, multithreading, callbacks, timers and exceptions, plus some hardware-related features like interrupts, PWM, digital I/O, etc.

The Zerynth VM is natively multithread and realtime. Indeed it is built on top of a RTOS, by wrapping its functionalities in a operative system abstraction layer. This means that the VM is agnostic of the underlying RTOS: porting activities are ongoing to have many VMs based on different RTOS.

Take a look here to get started with Arduino Due