Skip to content

Instantly share code, notes, and snippets.

View joelsa's full-sized avatar
🛠️
Building autonomous things

Joël Schulz-Andres joelsa

🛠️
Building autonomous things
View GitHub Profile
@joelsa
joelsa / tcp_rs485_minimal.cpp
Created April 29, 2026 10:55
Send RS485 over TCP to the Waveshare Ethernet to RS485 Adapter
// Minimal example: send and receive RS485 bytes over TCP via an Ethernet-to-RS485
// adapter (e.g. Waveshare). The adapter is transparent, bytes written to the TCP
// socket go out on the RS485 bus, and bytes received on RS485 arrive via TCP.
//
// Build: g++-14 -std=c++23 -o tcp_example tcp_example.cpp
// Usage: ./tcp_example 192.168.1.200 4196
#include <array>
#include <cstdint>
#include <cstdlib>