NetBurner 3.5.0
PDF Version
 
Web Socket DIP Switch

Supported Platforms: MODM7AE70, MOD5441x, NANO54415

This program illustrates how to use the NetBurner WebSocket class to display the state of the DIP switches on the MOD-DEV-70CR in real-time on a webpage. That means as soon as you flip the DIP switches on the development board, the state will change on the webpage without having to refresh the page.

The application continuously polls the DIP switches and sends the state of the DIP switches via a websocket to the client. It's not the most efficient implementation when considering CPU utilization but this app demonstrates the capabilities of a WebSocket to allow the server(NetBurner device) to send the state of a variable to the client(webpage) with low latency and minimal packet size. This app also illustrates how to use the NetBurner JSON library to build and send JSON objects from the NetBurner device to the client. In this case, JSON objects are used to pass the state of the DIP switches to the webpage.