ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
serverRpiPico.ino File Reference
#include <SPI.h>
#include <W5100lwIP.h>
#include <WiFiUdp.h>
#include <ProsecCoAP.h>

Macros

#define LEDP   LED_BUILTIN
 

Functions

Wiznet5100lwIP eth (17, SPI, 21)
 
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}
 
WiFiUDP Udp
 
Coap::Node coapNode (Udp)
 
bool LED_STATUS
 

Macro Definition Documentation

◆ LEDP

#define LEDP   LED_BUILTIN

A CoAP server example specific for W5100S-EVB-Pico board. It has been tested on WIZnet W5100S-EVB-Pico.

Requirements:

  • Install "https://github.com/earlephilhower/arduino-pico" (also through the Board Manager).
  • Select "WIZnet W5100S-EVB-Pico" board.

The current light status can be read using:

coap-client-notls -m get coap://192.168.0.99/light

and the light can be set ON or OFF, respectively, by using:

coap-client-notls -m put coap://192.168.0.99/light -e "1"
coap-client-notls -m put coap://192.168.0.99/light -e "0"

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:

coap-server-notls -v 9

Function Documentation

◆ callbackLight()

void callbackLight ( Coap::Message & packet,
IPAddress ip,
uint16_t port )

◆ callbackResponse()

void callbackResponse ( Coap::Message & packet,
IPAddress ip,
uint16_t port )

◆ deviceIp()

IPAddress deviceIp ( 192 ,
168 ,
0 ,
99  )

◆ eth()

Wiznet5100lwIP eth ( 17 ,
SPI ,
21  )

◆ loop()

void loop ( )

◆ setup()

void setup ( )

Variable Documentation

◆ coapNode

Coap::Node coapNode(Udp) ( Udp )

◆ LED_STATUS

bool LED_STATUS

◆ mac

byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}

◆ Udp

WiFiUDP Udp