Пример #1
0
from libsoc_zero.GPIO import Button

touch = Button('GPIO-C')

print('Waiting for press event...')
touch.wait_for_press()
print('Button was pressed!')
Пример #2
0
from libsoc_zero.GPIO import Button
from libsoc_zero.GPIO import LED
from time import sleep

btn = Button('GPIO-G')
led = LED('GPIO-E')


while True:

    btn.wait_for_press()
    if led.is_lit:
        led.off()
    else:
        led.off()

    sleep(1)
Пример #3
0
from libsoc_zero.GPIO import Button  #GPIO Libraries
from libsoc_zero.GPIO import Buzzer
from time import sleep
from time import time

helpButton = Button('GPIO-A0')
cancelButton = Button('GPIO-AB')
buzzerPin = Buzzer('GPIO-D5')

helpButton.wait_for_press()
falseAlarm = False

while falseAlarm == False:
    start = time()
    while start < 3:
        buzzerPin = HIGH
    while start < 120 and falseAlarm == False:
        if cancelButton.is_pressed():
            falseAlarm = True

if falseAlarm == False:
    findLocation()  #using GPS or Wifi
    #then send to HTML