Looking for TCP? See mbed-tcp-ping-pong.
Tested on ODIN-W2 EVK, but should work on every Mbed OS 5 device that implements the Network Sockets API.
Get both devices on the same WiFi network, or host the server on a publicly available hostname.
-
Install a recent version of node.js.
-
Open a terminal.
-
Navigate to the
server-in-node
directory. -
Run:
$ node server.js
-
Note down the IP address of the WiFi interface.
- Open
mbed_app.json
and set your connectivity method and WiFi credentials. - Open
main.cpp
and set the IP (or hostname) of the server. - Compile and flash on the device.
The Mbed device will set up a UDP socket to the server, and will send 'ping' the server. The server will respond with 'pong'.