IoTPy reference guide

IoTPy is Python API module for controlling GPIO, PWM, ADC, I2C, SPI on UPER and WUPER Cortex M0 boards. IoTPy runs on OpenWRT, Ubuntu, OSX and Windows platforms.

First steps


from pyuper.ioboard import IoBoard
from pyuper.adc import ADC
"""
Reading ADC value from pin No. 23 on UPER1 board
"""
with IoBoard() as board, board.get_pin(ADC, 23) as adc_pin:
    print "RAW ADC value:", adc_pin.read()

Controlling GPIO's


with u.get_pin(GPIO, 27) as r, u.get_pin(GPIO, 28) as g, u.get_pin(GPIO, 34) as b:
    b.mode(GPIO.PULL_DOWN)
    print b.read()
    b.mode(GPIO.PULL_UP)
    print b.read()
    try:
        for i in cycle([0,1]):
            r.write(i)
            g.write(i)
            b.write(i)
            sleep(0.5)
    except KeyboardInterrupt:
        die("Keyboard interrupt.")

Class: i2c