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/

Revision:
0:88ff4115c392
diff -r 000000000000 -r 88ff4115c392 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 13 13:03:27 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file