Use your Arduino board with Python.
Use your Arduino board with Python. http://pypi.python.org/pypi/nanpy
Nanpy is a library that use your Arduino as a slave, controlled by a master device where you run your scripts, such as a PC, a Raspberry Pi etc.
The main purpose of Nanpy is making programmers’ life easier, providing them a powerful library to create prototypes faster and make Arduino programming a game for kids.
from nanpy import ArduinoApi a = ArduinoApi() a.pinMode(13, a.OUTPUT) a.digitalWrite(13, a.HIGH)
I know, there are a lot of projects able to do that, but hey, Nanpy can do more!
Nanpy is easily extensible and can theoretically use every library, allowing you to create how many objects you want. We support OneWire, Lcd, Stepper, Servo, DallasTemperature and many more…
Let’s try to connect our 16x2 lcd screen on pins 7, 8, 9, 10, 11, 12 and show your first “Hello world”!
from nanpy import Lcd lcd = Lcd([7, 8, 9, 10, 11, 12], [16, 2]) lcd.printString('Hello World!')
really straightforward now, isn’t it? :)
Nanpy autodetects the serial port for you, anyway you can manually specify another serial port:
from nanpy import SerialManager connection = SerialManager(device='/dev/ttyACM1')
and use it with your objects
from nanpy import ArduinoApi a = ArduinoApi(connection=connection) a.pinMode(13, a.OUTPUT) a.digitalWrite(13, a.HIGH)
You can specify how many SerialManager objects you want and control more than one Arduino board within the same script.
How to build and install
git clone https://github.com/nanpy/nanpy-firmware.git cd nanpy-firmware ./configure.sh
To install Nanpy Python library on your master device just type:
pip install nanpy
How to contribute
Nanpy still needs a lot of work. You can contribute with patches (bugfixing, improvements, adding support for a new library not included in Nanpy yet, writing examples and so on), writing documentation, reporting bugs, creating packages or simply spreading Nanpy through the web if you like it :) If you have any doubt or problem, please contact me at email@example.com
Do you want to support us with a coffee? We need a lot of caffeine to code all night long! if you like this project and you want to support us, please donate using Paypal
This software is released under MIT License. Copyright (c) 2012-2016 Andrea Stagi firstname.lastname@example.org
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size nanpy-0.9.6.tar.gz (33.8 kB)||File type Source||Python version None||Upload date||Hashes View|
|Filename, size nanpy-firmware-0.9.6.tar.gz (44.5 kB)||File type Source||Python version None||Upload date||Hashes View|