blob: eba80e921ad75889f5c274aa347cee45558da1ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
from webiopi.protocols.coap import *
from time import sleep
client = COAPClient()
client.sendRequest(COAPPost("coap://224.0.1.123/GPIO/25/function/out"))
state = True
while True:
response = client.sendRequest(COAPPost("coap://224.0.1.123/GPIO/25/value/%d" % state))
if response:
print("Received response:\n%s" % response)
state = not state
else:
print("No response received")
sleep(0.5)
|