ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
Examples

The library ships 152 runnable examples under examples/, grouped by the OSI layer the feature lives at and numbered within each group. Each example has its own README with a detailed walkthrough, the build flags it needs, how to build and run it, and the full source reproduced with teaching comments - so this page is just the index. Click any example below.

Building and running an example

Most examples need WiFi: open the .ino and set SSID / PASSWORD before flashing. Compile one for an ESP32 board with pio ci:

pio ci --board=esp32dev --project-option="framework=arduino" \
--project-option="build_flags=-DPC_ENABLE_WEBSOCKET=1" \
--lib="." examples/L6-Presentation/WebSocket/WebSocket.ino

The build_flags gotcha. A sketch's #define PC_ENABLE_X 1 only affects the sketch's own translation unit; the library is compiled separately and will not see it, producing link errors like undefined reference to begin_tls. When building with pio ci, pass each feature's flag as build_flags (the -D... form above) so the library is compiled with it too. Each example's README lists the exact flags. In the Arduino IDE the library compiles with your sketch, so the in-sketch #define (or setting it in protocore_config.h) is enough.

Troubleshooting

  • **undefined reference to ...** - the build_flags gotcha above; pass the flags to the library build.
  • **#error "... requires ..."** - an illegal flag combination; see the build-flag dependency tree.
  • No WiFi - set SSID/PASSWORD; TLS examples also need wall-clock time (pair with the SNTP example).
  • **begin() returns negative** - a capacity constant is too small for the configured pools (the compile-time checks in protocore_config.h catch most first).
  • Built but not flashed - pio ci only compiles; use pio run -t upload from a project containing the sketch.
CORE · Foundation · 9 examples

Start here: the core tutorial path (Basic -> Advanced -> Expert -> Sysadmin -> Configuration), then the server-architecture examples - the preempting task queue, lanes, and interface forwarding:

HW · Peripherals · 6 examples

On-chip and add-on interface hardware - Ethernet (internal + W5500), CAN, Wi-Fi capture, and DMA ingest:

HW · Drivers · 18 examples

External chip drivers over I2C / SPI / UART - sensors, ADC / PWM / current monitors, an RTC, and radio-module gateways:

L4 · Transport · 8 examples

Connections, encryption, and flood defense:

L5 · Session · 7 examples

Interactive consoles: