SI1143 Gesture Sensor

http://www.parallax.com/sites/default/files/styles/full-size-product/public/28046.png

The Parallax SI1143 Gesture Sensor is a low-power, reflectance-based, infrared proximity, and ambient light sensor with I2C digital interface and programmable-event interrupt output.

Hello World!

Import program

00001 #include "mbed.h"
00002 #include "SI1143.h"
00003 
00004 SI1143 sensor(p28, p27);
00005 
00006 DigitalOut led1(LED1);
00007 DigitalOut led2(LED2);
00008 DigitalOut led3(LED3);
00009 
00010 int main()
00011 {
00012     int sense1,sense2,sense3;
00013     
00014     // Setup the baseline
00015     sensor.bias(1,5);
00016     wait(1);
00017     
00018     while(1)
00019     {
00020         // Read each led sensor
00021         sense1 = sensor.get_ps1(1);
00022         sense2 = sensor.get_ps2(1);
00023         sense3 = sensor.get_ps3(1);
00024         
00025         // Can be changed for different sensitivity
00026         if (sense1 > 80 || sense2 > 80 || sense3 > 80)
00027         {
00028             if (sense1 > sense2 && sense1 > sense3)
00029             {
00030                 led1=1;
00031                 led2=0;
00032                 led3=0;
00033             }
00034             
00035             else if(sense2 > sense1 && sense2 > sense3)
00036             {
00037                 led1=0;
00038                 led2=1;
00039                 led3=0;
00040             }
00041             
00042             else if(sense3 > sense1 && sense3 > sense2)
00043             {
00044                 led1=0;
00045                 led2=0;
00046                 led3=1;
00047             }
00048         }
00049         
00050         else
00051         {
00052             led1=0;
00053             led2=0;
00054             led3=0;
00055         }
00056         
00057         //Numeriacl output through terminal
00058         printf("%d-%d-%d\r\n",sense1,sense2,sense3);
00059     }
00060 }

This program will check to see where an object is and light up an led on the mbed. Led1 corresponds to the bottom left, led2 corresponds to the top, and led3 corresponds to the bottom right.

Library

Import librarySI1143

Starting library to get the SI1143 Gesture Sensor to work. Currently only works in forced conversion mode.

Wiring

SI1143 pinsmbed pins
GND0V
VIN3.3V
INTnot connected
SCLp27, via 4.7k resistor to VIN
SDAp28, via 4.7k resistor to VIN

API

Import library

Public Member Functions

  SI1143 (PinName sda, PinName scl)
  Constructor.
void  restart (void)
  Restarts the device.
void  bias (int ready, int repeat)
  Creates a baseline for sampling measurements.
int  get_ps1 (int repeat)
  Takes a number of samples from the proximity of led1 and returns a raw output.
int  get_ps2 (int repeat)
  Takes a number of samples from the proximity of led2 and returns a raw output.
int  get_ps3 (int repeat)
  Takes a number of samples from the proximity of led3 and returns a raw output.
int  get_vis (int repeat)
  Takes a number of samples for ambient light on device and returns a raw output.
int  get_ir (int repeat)
  Takes a number of samples for infrared light on device and returns a raw output.

Reference


Please log in to post comments.