ProtoCore v1.0.16
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=-DPROTOCORE_ENABLE_WEBSOCKET=1" \
--lib="." examples/L6-Presentation/WebSocket/WebSocket.ino

The build_flags gotcha. A sketch's #define PROTOCORE_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 · 10 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:

  • Advanced
  • Basic
  • Configuration
  • Expert
  • IdemIpPing
  • InterfaceForward
  • IPv6
  • PreemptLanes
  • PreemptQueue
  • Sysadmin

HW · Peripherals · 6 examples

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

  • CanCapture
  • DmaIngest
  • Ethernet
  • EthernetW5500
  • WifiCapture
  • WifiSniffer

HW · Drivers · 18 examples

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

  • Ads1115
  • EnOceanGateway
  • Ina219
  • Ld2410
  • LoRaGateway
  • Mpr121
  • NfcGateway
  • Nrf24Gateway
  • Pca9685
  • RadioGateway
  • Rtc
  • Sen0192
  • Sht3x
  • SigfoxUplink
  • ThreadGateway
  • UbloxGnss
  • ZigbeeGateway
  • ZWaveGateway

L4 · Transport · 7 examples

Connections, encryption, and flood defense:

  • AcceptThrottle
  • DiffServ
  • HTTPS
  • IpAllowlist
  • KeepAlive
  • PerIpThrottle
  • TlsResumption

L5 · Session · 7 examples

Interactive consoles:

  • IKEv2
  • SSH
  • SSHCryptoSelfTest
  • SSHHostKey
  • SSHReverseTunnel
  • SSHSftp
  • Telnet

L6 · Presentation · 15 examples

Parsing, codecs, auth, WebSocket/SSE:

  • AuthLockout
  • BasicAuth
  • Cbor
  • DigestAuth
  • FormParams
  • ForwardedTrust
  • Json
  • JWTAuth
  • MsgPack
  • Multipart
  • SecureWebSocket
  • ServerSentEvents
  • WebSocket
  • WebSocketCompression
  • WebTerminal

L7 · Application · 89 examples

Routing, protocols, services, and clients:

  • AdsClient
  • AuditLog
  • ChunkedResponse
  • CoAP
  • CoapBlock
  • CoapObserve
  • CoapSecure
  • ConfigExport
  • CoreDump
  • CORS
  • Csrf
  • Dashboard
  • DeviceUuid
  • Diagnostics
  • DnsResolver
  • DnsServer
  • EdgeCache
  • EspNow
  • ETag
  • EthernetDnc
  • Euromap77
  • FileServing
  • FileUpload
  • Gpib
  • GpioMap
  • GraphQL
  • Guardrails
  • HaasMdc
  • HeidenhainLsv2
  • HiSlip
  • HotSwapStorage
  • HttpClient
  • HttpDelivery
  • InterfaceBridge
  • InterfaceFilter
  • LogBuffer
  • mDNS
  • MdnsAdaptive
  • MediaStreaming
  • MeshCache
  • Middleware
  • Mnt
  • ModbusScan
  • ModbusTcp
  • MqttClient
  • NetEgress
  • NtpServer
  • NtripCaster
  • OAuth2
  • OidcAuth
  • OpcUa
  • OpcUaClient
  • OTA
  • OtaRollback
  • PackML
  • PartitionMonitor
  • PathParams
  • PidTuning
  • PortForward
  • PowerGovernor
  • PrometheusMetrics
  • Provisioning
  • Ptp
  • RadioPower
  • Range
  • RegexRoutes
  • ResponseHeaders
  • Robotics
  • Scpi
  • SimaticSerial
  • SmbFileClient
  • SmtpAlert
  • SNMP
  • SnmpTrap
  • SNTP
  • SpaFallback
  • Stats
  • StatsdMetrics
  • Syslog
  • Telemetry
  • Templating
  • TimeSourceFallback
  • Totp
  • UdpTelemetry
  • Umati
  • Vxi11
  • WebDav
  • Webhook
  • WebSocketClient