This program simulates a dual dice throw by pushing the 2 buttons on the QW dev kit. The results of the throw are shown in binary on the leds, printed in the console window and transmitted via Sigfox.

Dependencies:   mbed

Fork of QW-BinaryDices by Quicksand

Homepage

QW Binary Dices

This program simulates a dual dice throw by pushing the 2 buttons on the QW dev kit. The results of the throw are shown in binary on the leds, printed in the console window and transmitted via Sigfox.

Code explanation

The program starts with the initialisation/declaration of the leds and pushbuttons. Also the necessary function prototypes and serial communications are declared. After that, the program enters an infinite loop and waits till both buttons have been pushed. Once both buttons have been pushed, the result is shown in binary on the leds (LED_3 = LSB), printed in the console window and transmitted via Sigfox. When the Sigfox message is transmitted, the program is ready to throw the dices again.

Sigfox message payload

First there is the "04", this is the Quicksand ID of the example program. This is used by Quicksand to keep track of our example programs. The second value that is transmitted is the number that was thrown by the dices.

More information and other example code can be found on the component page by clicking the link below: https://developer.mbed.org/components/QW-SIGFOX-Development-Kit/