forked from akrishnan93-zz/Smart-Security-Strip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (35 loc) · 829 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import webiopi
from webiopi.clients import *
from time import sleep
gpio = webiopi.GPIO
PIN=4
def setup():
gpio.setFunction(PIN, gpio.OUT)
def destroy():
print("destroy called")
gpio.digitalWrite(PIN, gpio.HIGH)
exit()
@webiopi.macro
def blink(userInput):
count = 0
while (count < int(userInput) * 2):
state = gpio.digitalRead(PIN)
gpio.digitalWriter(PIN, not state)
print("in blink")
webiopi.sleep(1)
count = count + 1
@webpio.macro
def SOS():
print("in SOS")
count = 0
while (count < 8):
state = gpio.digitalRead(PIN)
gpio.digitalWrite(PIN, not state)
webipio.sleep(0.3)
count = count + 1
@webiopi.macro
def setCount(count):
global COUNT
COUNT = int(count)
print("in count function")
print(count)