Macros | |
| #define | LEDP LED_BUILTIN |
Functions | |
| IPAddress | deviceIp (192, 168, 0, 99) |
| void | callbackLight (Coap::Message &packet, IPAddress ip, uint16_t port) |
| void | callbackResponse (Coap::Message &packet, IPAddress ip, uint16_t port) |
| void | setup () |
| void | loop () |
Variables | |
| byte | mac [] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02} |
| EthernetUDP | Udp |
| Coap::Node | coapNode (Udp) |
| bool | LED_STATUS |
| #define LEDP LED_BUILTIN |
A CoAP server.
The current light status can be read using:
and the light can be set ON or OFF, respectively, by using:
Note that on some boards, ON/OFF logic may be inverted.
In addition, this example also acts as client, sending a GET request every second. To receive such requests, start a CoAP server on the remote machine. To test, you may use:
| void callbackLight | ( | Coap::Message & | packet, |
| IPAddress | ip, | ||
| uint16_t | port ) |
| void callbackResponse | ( | Coap::Message & | packet, |
| IPAddress | ip, | ||
| uint16_t | port ) |
| IPAddress deviceIp | ( | 192 | , |
| 168 | , | ||
| 0 | , | ||
| 99 | ) |
| void loop | ( | ) |
| void setup | ( | ) |
| Coap::Node coapNode(Udp) | ( | Udp | ) |
| bool LED_STATUS |
| byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02} |
| EthernetUDP Udp |