Go Down

Topic: Python for Arduino Due (Read 3744 times) previous topic - next topic

randomvibe

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?

io53

Python is a scripting language...                               No.

dxw00d

Quote
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/

jgmdavies

#3
Oct 30, 2012, 02:50 pm Last Edit: Oct 30, 2012, 07:34 pm by jgmdavies Reason: 1
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
http://atmega32-avr.com/using-atmega16-micrcontroller-running-python-pymite-09-on-an-arduino-mega-2560/

Jim

Grumpy_Mike

Quote
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!

westfw

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...

jgmdavies

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

ogre


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!


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.

Grumpy_Mike

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

Very easy to say, very hard to implement.

ogre


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++.

ogre


Quote
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.

Go Up