mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-19 03:59:45 +00:00
Init ESDS repository
This commit is contained in:
commit
c2e6aad09f
106 changed files with 2638 additions and 0 deletions
28
example/receiver.py
Normal file
28
example/receiver.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys, random, time
|
||||
|
||||
lr=random.Random(6)
|
||||
|
||||
def execute(api):
|
||||
uptime=api.args
|
||||
endoff=0
|
||||
for i in range(0,24):
|
||||
startoff=random.randint(0,3600-uptime)
|
||||
api.turn_off()
|
||||
api.wait(startoff+endoff)
|
||||
api.turn_on()
|
||||
wakeat=api.read("clock")
|
||||
wakeuntil=wakeat+uptime
|
||||
# Receive until uptime seconds if elapsed
|
||||
while api.read("clock") < wakeuntil:
|
||||
code, data=api.receivet("wlan0",wakeuntil-api.read("clock"))
|
||||
if code == 0:
|
||||
api.log("Receive "+data)
|
||||
api.log("Was up for {}s".format(api.read("clock")-wakeat))
|
||||
endoff=3600*(i+1)-api.read("clock")
|
||||
api.turn_off()
|
||||
api.wait(endoff)
|
||||
api.turn_on()
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue