GOTO

Monday, October 8, 2012

Nanpy - Use your Arduino board with Python

I bought my first Arduino three months ago and now I can sell my Wii and
Nintendo DS cause I've finally found my best toy ever :) I started
hacking with guys of my LUG (PtLUG), preparing some talks for the incoming LinuxDay to
show what Arduino is able to do (!) and also I started working on a project called Nanpy, a
library that allows you writing Arduino programs using Python, my
favorite language, and that's the thing I would like to speak about in
this post :) .. I know, I know, there's a lot of projects doing the
same thing, but Nanpy can do more.. Lemme show you :)

Nanpy (https://github.com/Octan/nanpy) was born to help developers
writing their Arduino programs using Python, communicating via serial
port without sending hard-to-remember codes or limiting you to use
only one object: with Nanpy when you create an object in Python it
will be automatically created into your Arduino at runtime.. For
example if you write something like:
ds = DallasTemperature(5)
or
tone = Tone(13)
Nanpy creates the object for you into Arduino.. Also, you haven't to
take care of deallocation, Nanpy deallocates objects into Arduino as
soon as the correspondent Python objects get deleted. Look at the
examples to see how simple it is..
(https://github.com/Octan/nanpy/tree/master/examples) :)

I tried running Nanpy on a Raspberry board and it works great!!
(that's the result
https://twitter.com/andreagrandi/status/251702684380434434 :) ). Also
you may use it in other devices supporting Python and serial
communication, in a web service or simply for creating prototypes
faster, because you use Python and you don't have to flash the
firmware every time. Last but not least, firmware part of Nanpy is
Python-indipendent, so you can write another implementation of Nanpy
in any other language, for example Java, and see an Arduino controlled
via Android (ok, in this case you should use Android USB Host API and
USART, writing your own driver, because Android doesn't provide
anything to access device files.. we just did that for a robotic
project https://github.com/Octan/chickenfoot).

Nanpy started a month ago but it's just a useful library: it actually
supports the main parts of OneWire, Lcd, DallasTemperature, Stepper,
Servo and basic Arduino's function (digital and analog write, tone
etc..).

If you find Nanpy interesting please spread the project, there's a lot
of work to do, many things to rewrite better and we need developers :)

Pypi? Oh Ye4H!! http://pypi.python.org/pypi/nanpy/

Wah! Do you want to make a donation to this project? Click the donation button and buy me a coffee...!! I'd like to buy new Arduino boards to work on compatibility with Nanpy.. Thanks :)

Cya next post!

=.4.S.=

No comments:

Post a Comment