Giter Site home page Giter Site logo

relsi / pingo-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pingo-io/pingo-py

0.0 2.0 0.0 29.39 MB

Generic API for controlling boards with programmable IO pins

Home Page: http://pingo.io

License: MIT License

Makefile 0.36% Python 98.45% Shell 0.19% Vim Script 0.99%

pingo-py's Introduction

Pingo means "pin, go!"

Travis CI badge Coveralls badge

Pingo provides a uniform API to program devices like the Raspberry Pi, BeagleBone Black, pcDuino etc. just like the Python DBAPI provides an uniform API for database programming in Python.

The API is object-oriented but easy to use: a board is an instance of a Board subclass. Every board has a dictionary called pins which lists all GPIO pins on the board. Each pin is an instance of a Pin subclass with attributes that you can inspect to learn about its capabilities.

The name Pingo is a tribute to Garoa Hacker Clube, where the project started (the words pingo and garoa are related in Portuguese). To our English-speaking friends we like to say that it means "pin, go!" -- the main purpose of this package.

Media

Watch it on Youtube: https://www.youtube.com/watch?v=pAOooxPL_tQ

Intel IoT RoadShow São Paulo 2014

Intel IoT RoadShow São Paulo 2014

Basic usage

To use pingo, the first step is to instantiate a Board. Each Pingo driver is a concrete board subclass, for example, pingo.rpi.RaspberryPi and pingo.arduino.ArduinoFirmata are two such classes.

Pingo can automatically detect the board in most common cases. If the script is running on a supported board, pingo.detect.MyBoard() returns an suitable board instance. If Pingo is running on an unsupported machine (eg. a notebook), it will try to find a connected Arduino using the Firmata protocol via USB and -- if successful -- will return a pingo.arduino.ArduinoFirmata instance.

Once you have a board instance, it's possible to access its pins through the board.pins dictionary:

import pingo
from time import sleep

board = pingo.detect.get_board()
led_pin = board.pins[13]
led_pin.mode = pingo.OUT

while True:
    led_pin.hi()
    sleep(1)
    led_pin.lo()
    sleep(1)

Drivers

pingo.pcduini.PcDuino pingo.galileo.Galileo2 are examples of drivers, and the respective PcDuino and Galileo2 are subclasses of the pingo.board.Board abstract class that defines the common API for all boards.

The following table lists the drivers currently planned or under development.

Board Type Module/Package Status Notes
Arduino Firmata remote arduino.firmata level 1 requires firmata protocol on any Arduino board
Arduino Yún on-board arduino.yun level 2 requires Bridge sketch on the Arduino Yún
BeagleBone Black on-board bbb level 1 requires `Adafruit_BBIO`_ on the BeagleBone Black
Intel Galileo Gen 2 on-board intel.galileo level 2 requires Intel IoT Dev Kit mraa library
Intel Edison on-board intel.edison level 1 requires Intel IoT Dev Kit mraa library
LinkSprite pcDuino on-board pcduino level 1  
RaspberryPi on-board rpi level 0 requires RPi.GPIO on the Raspberry Pi
SECO UDOO on-board udoo level 0  

We are also interested in supporting: Banana Pi, Cubietech Cubieboard, SolidRun HummingBoard, TI MSP430 (via firmata protocol ).

In a addition, Pingo implements ghost, a mock software-only board for testing the API.

Types of drivers

on-board
Pingo and user code run on the board itself, using the Python interpreter installed in it.
remote
Pingo and user code run on host computer connected to board, controlling the board remotely. Useful for boards that are unable to run Python, like the Arduino UNO.
fake
Pingo and user code run on host computer emulating a dummy board in software. Useful for testing base classes from board.py and for teaching and demonstration.

Status of drivers

level 0
Digital I/O: get/set high/low status of digital pins (no PWM support).
level 1
Analog input: read values from analog pins.
level 2
PWM output: set variable value for digital pins with PWM capability.
experiments
Some Python experiments have been done with the board. See the experiments/ directory for code that may be helpful to start a new driver for a board.
none
Nothing has been done. Great opportunity for you to contribute with experiments and/or start a new driver.

pingo-py's People

Contributors

ramalho avatar vido avatar valdergallo avatar lamenezes avatar gfth4x07 avatar rimolive avatar alexandre avatar rbanffy avatar danilobellini avatar hvelarde avatar humrochagf avatar dyegocantu avatar davivcgarcia avatar fabaff avatar felipesanches avatar kemelzaidan avatar scls19fr avatar turicas avatar

Watchers

Relsi Maron avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.