
Si1143 Gesture Sensor sample.
Fork of Gesture_Sensor by
About Si1143
Si1143 is a gesture sensor and can be controlled by using the I2C.
This can be detected from the shortest 1cm up to 200cm.
Si1143 emits three infrared LED that is mounted on a substrate, and detects the movement by measuring the reflected light from the external object.
- Datasheet of Si1143
http://www.silabs.com/Support%20Documents/TechnicalDocs/Si114x.pdf
About sample program
When you hold your hand on the upper of LED1 of Si1143, LED1 (red) of GR-PEACH lights up.
When you hold your hand on the upper of LED2 of Si1143, LED2 (green) of GR-PEACH lights up.
When you hold your hand on the upper of LED3 of Si1143, LED3 (blue) of GR-PEACH lights up.
When you approach your hand to LED of Si1143, level of the LED light will output a large value.
About wiring
Sensor | GR-PEACH |
GND | GND |
VIN | 3.3V |
SCL | D15 |
SDA | D14 |
main.cpp
- Committer:
- GAT27
- Date:
- 2013-10-17
- Revision:
- 0:03bf686bd26a
- Child:
- 1:a4c6fbb79eba
File content as of revision 0:03bf686bd26a:
#include "mbed.h" #include "SI1143.h" SI1143 sensor(p28, p27); DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); int main() { int sense1,sense2,sense3; // Setup the baseline sensor.bias(); wait(1); while(1) { // Read each led sensor sense1 = sensor.sample(1); sense2 = sensor.sample(2); sense3 = sensor.sample(3); // Can be changed for different sensitivity if (sense1 > 80 || sense2 > 80 || sense3 > 80) { if (sense1 > sense2 && sense1 > sense3) { led1=1; led2=0; led3=0; } else if(sense2 > sense1 && sense2 > sense3) { led1=0; led2=1; led3=0; } else if(sense3 > sense1 && sense3 > sense2) { led1=0; led2=0; led3=1; } } else { led1=0; led2=0; led3=0; } //Numeriacl output through terminal printf("%d-%d-%d\r\n",sense1,sense2,sense3); } }