This program shows how to use the VCNL4010 (proximity and ambient light sensor) on the QW dev kit for motion detection. When motion is detected, a message is shown in the console window and transmitted via Sigfox.

Dependencies:   QW_Sensors mbed

Fork of QW-Motiondetection by Quicksand

QW Motion Detection

This program shows how to use the VCNL4010 (proximity and ambient light sensor) on the QW dev kit for motion detection. When motion is detected, a message is shown in the console window and transmitted via Sigfox.

Code explanation

The program starts with the initialisation/declaration of the leds, pushbuttons and sensor. Also the necessary function prototypes and serial communications are declared. After the initialisation phase, the sensor ID is read and the IR-led current is set. After that, the program enters an infinite loop. Each loop the proximity value is read. When a certain threshold is passed, a led is turned on to indicate motion detection, a message is shown in the console window and a Sigfox message is transmitted. When the Sigfox message is transmitted, the loop continuous.

Sigfox message payload

First there is the "03", 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 proximity value the moment when motion was detected.

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/

mbed.bld

Committer:
quicksandjonas
Date:
2016-12-13
Revision:
0:88ff4115c392

File content as of revision 0:88ff4115c392:

http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb