ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
serverRpiPico.ino File Reference

A CoAP server example specific for Raspberry Pi Pico. More...

#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)
 
IPAddress dns (0, 0, 0, 0)
 
IPAddress gateway (0, 0, 0, 0)
 
IPAddress subnet (255, 255, 255, 0)
 
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
 

Detailed Description

A CoAP server example specific for Raspberry Pi Pico.

Tested on WIZnet W5100S-EVB-Pico. Other boards may require changes.

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.

Macro Definition Documentation

◆ LEDP

#define LEDP   LED_BUILTIN

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  )

◆ dns()

IPAddress dns ( 0 ,
0 ,
0 ,
0  )

◆ eth()

Wiznet5100lwIP eth ( 17 ,
SPI ,
21  )

◆ gateway()

IPAddress gateway ( 0 ,
0 ,
0 ,
0  )

◆ loop()

void loop ( )

◆ setup()

void setup ( )

◆ subnet()

IPAddress subnet ( 255 ,
255 ,
255 ,
0  )

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