def init():

    print("Simple obstacle avoider")
    print("Press Ctrl-C to end")
    print()

    pz.init()
    pz.setOutputConfig(5, 3)  # set output 5 to WS2812
    rev = pz.getRevision()
    print(rev[0], rev[1])
    hcsr04.init()
Exemple #2
0
#! /usr/bin/env python

# GNU GPL V3
# Test code for 4tronix Picon Zero

import piconzero as pz

pz.init()
vsn = pz.getRevision()
if (vsn[1] == 2):
    print("Board Type:", "Picon Zero")
else:
    print("Board Type:", vsn[1])
print("Firmware version:", vsn[0])
print()
pz.cleanup()
Exemple #3
0

def sensor_activated():
    gpio_in = gpio.GPIO(GPIO.gpio_id("GPIO-A"), gpio.DIRECTION_INPUT)
    with gpio.request_gpios(gpio_in):
        in_val = gpio_in.is_high()
    return in_val


pz.init()
pz.setOutputConfig(0, 2)  # set output 0 to Servo
pz.setOutputConfig(1, 1)  # set output 1 to PWM
pz.setOutputConfig(2, 1)  # set output 2 to PWM
pz.setOutputConfig(3, 1)  # set output 3 to PWM

rev = pz.getRevision()
print rev[0], rev[1]
try:
    while True:
        while not sensor_activated():
            sleep(1)
        for x in range(0, 50):
            pz.setOutput(1, x)
            time.sleep(0.04)
        pz.setOutput(1, 0)
        sleep(3)
except KeyboardInterrupt:
    print
finally:
    pz.cleanup()
Exemple #4
0
#! /usr/bin/env python

# GNU GPL V3
# Test code for 4tronix Picon Zero

import piconzero as pz

pz.init()
vsn = pz.getRevision()
if (vsn[1] == 2):
    print "Board Type:", "Picon Zero"
else:
    print "Board Type:", vsn[1]
print "Firmware version:", vsn[0]
print
pz.cleanup()

Exemple #5
0
#! /usr/bin/env python

# GNU GPL V3
# Test code for 4tronix Picon Zero

import piconzero as pz, time

pz.init()
pz.setOutputConfig(5, 3)    # set output 5 to WS2812
rev = pz.getRevision()
print rev[0], rev[1]
try:
    while True:
        pz.setAllPixels(255,255,255)
        time.sleep(1)
        pz.setAllPixels(0,0,0)
        time.sleep(1)
except KeyboardInterrupt:
    print
finally:
    pz.cleanup()