Add files via upload
This commit is contained in:
@@ -73,8 +73,7 @@ oled.show()
|
|||||||
statusled.value(1)
|
statusled.value(1)
|
||||||
alertled.value(0)
|
alertled.value(0)
|
||||||
|
|
||||||
def konec(p):
|
|
||||||
exit=1
|
|
||||||
|
|
||||||
sleeptime=15
|
sleeptime=15
|
||||||
count=0
|
count=0
|
||||||
@@ -82,6 +81,20 @@ vlaga=0
|
|||||||
temp=0
|
temp=0
|
||||||
svetloba=0
|
svetloba=0
|
||||||
ms=sleeptime*1000
|
ms=sleeptime*1000
|
||||||
|
exitf=0
|
||||||
|
|
||||||
|
|
||||||
|
def exit():
|
||||||
|
oled.fill(0)
|
||||||
|
oled.text('<-------------->', 0, 15)
|
||||||
|
oled.text('<NodeMCU Senzor>', 0, 25)
|
||||||
|
oled.text('<-------------->', 0, 35)
|
||||||
|
oled.text(' !Nasvidenje! ', 0, 50)
|
||||||
|
oled.show()
|
||||||
|
time.sleep(1.5)
|
||||||
|
oled.fill(0)
|
||||||
|
oled.show()
|
||||||
|
oled.poweroff()
|
||||||
|
|
||||||
def updatescreen():
|
def updatescreen():
|
||||||
global vlaga, temp, svetloba, sleeptime
|
global vlaga, temp, svetloba, sleeptime
|
||||||
@@ -97,7 +110,7 @@ active=0
|
|||||||
|
|
||||||
def carefulsleep():
|
def carefulsleep():
|
||||||
startticks=time.ticks_ms()
|
startticks=time.ticks_ms()
|
||||||
global ms, active, lasttick, firsttick, exit
|
global ms, active, lasttick, firsttick, exitf
|
||||||
while time.ticks_diff(time.ticks_ms(), startticks) < ms:
|
while time.ticks_diff(time.ticks_ms(), startticks) < ms:
|
||||||
updatescreen()
|
updatescreen()
|
||||||
if not tipka.value():
|
if not tipka.value():
|
||||||
@@ -106,19 +119,20 @@ def carefulsleep():
|
|||||||
firsttick=time.ticks_ms()
|
firsttick=time.ticks_ms()
|
||||||
lasttick=time.ticks_ms()
|
lasttick=time.ticks_ms()
|
||||||
if time.ticks_diff(lasttick, firsttick) > 3000 and active==1:
|
if time.ticks_diff(lasttick, firsttick) > 3000 and active==1:
|
||||||
print('ttt')
|
#print('ttt')
|
||||||
exit=3
|
exitf=3
|
||||||
active=0
|
active=0
|
||||||
|
exit()
|
||||||
if time.ticks_diff(time.ticks_ms(), lasttick) > 60 and active==1:
|
if time.ticks_diff(time.ticks_ms(), lasttick) > 60 and active==1:
|
||||||
print("BING!")
|
#print("BING!")
|
||||||
lasttick=0
|
lasttick=0
|
||||||
firsttick=0
|
firsttick=0
|
||||||
active=0
|
active=0
|
||||||
setsleep(0)
|
setsleep()
|
||||||
print(lasttick, firsttick,time.ticks_diff(lasttick, firsttick))
|
#print(lasttick, firsttick,time.ticks_diff(lasttick, firsttick))
|
||||||
|
|
||||||
|
|
||||||
def setsleep(x):
|
def setsleep():
|
||||||
global ms
|
global ms
|
||||||
sleeptime=ms/1000
|
sleeptime=ms/1000
|
||||||
if sleeptime==15:
|
if sleeptime==15:
|
||||||
@@ -140,9 +154,6 @@ def setsleep(x):
|
|||||||
|
|
||||||
#tipka.irq(trigger=Pin.IRQ_FALLING, handler=setsleep)
|
#tipka.irq(trigger=Pin.IRQ_FALLING, handler=setsleep)
|
||||||
|
|
||||||
exit=0
|
|
||||||
temp=0
|
|
||||||
svetloba=0
|
|
||||||
def acq():
|
def acq():
|
||||||
oled.text('BUSY...',70,55)
|
oled.text('BUSY...',70,55)
|
||||||
alertled.value(1)
|
alertled.value(1)
|
||||||
@@ -169,18 +180,7 @@ def acq():
|
|||||||
lasttick=0
|
lasttick=0
|
||||||
firsttick=0
|
firsttick=0
|
||||||
|
|
||||||
while exit<1:
|
while exitf<1:
|
||||||
acq()
|
acq()
|
||||||
updatescreen()
|
updatescreen()
|
||||||
carefulsleep()
|
carefulsleep()
|
||||||
|
|
||||||
oled.fill(0)
|
|
||||||
oled.text('<-------------->', 0, 15)
|
|
||||||
oled.text('<NodeMCU Senzor>', 0, 25)
|
|
||||||
oled.text('<-------------->', 0, 35)
|
|
||||||
oled.text(' !Nasvidenje! ', 0, 50)
|
|
||||||
time.sleep(1.5)
|
|
||||||
oled.show()
|
|
||||||
oled.fill(0)
|
|
||||||
oled.show()
|
|
||||||
oled.poweroff()
|
|
||||||
Reference in New Issue
Block a user