Any application that supports WebSockets can now communicate with Nuimo.
- Start Nuimo WebSocket Server
- Enable your Mac's Bluetooth and power on Nuimo. Nuimo WebSocket Server automatically connects to your Nuimo.
- Open a WebSocket to port 8080 (or the port number you've chosen)
- Receive all Nuimo events by reading from the WebSocket
- Write to the WebSocket to modify Nuimo's LED Matrix
- Copy and paste the following snippet into a
nuimo.html
file - Open it in your browser (Firefox users need to enable web sockets)
- Open the developer console to see incoming Nuimo events
- Use
ws.send('***')
to write to Nuimo's LED matrix
<script>
var ws = new WebSocket('ws://localhost:8080/');
ws.onopen = function() {
ws.send(
' * ' +
' *** ' +
' ***** ' +
' ******* ' +
'*********' +
' ******* ' +
' ***** ' +
' *** ' +
' * ')
}
ws.onmessage = function(event) {
console.log('Received Nuimo event: ' + event.data);
};
</script>