Yet Another WebIOPi+
 All Classes Namespaces Files Functions Variables Macros Pages
coap-client.py
Go to the documentation of this file.
1 from webiopi.protocols.coap import *
2 from time import sleep
3 
4 client = COAPClient()
5 client.sendRequest(COAPPost("coap://224.0.1.123/GPIO/25/function/out"))
6 state = True
7 
8 while True:
9  response = client.sendRequest(COAPPost("coap://224.0.1.123/GPIO/25/value/%d" % state))
10  if response:
11  print("Received response:\n%s" % response)
12  state = not state
13  else:
14  print("No response received")
15  sleep(0.5)