Code to test sensor.

Dependencies:   SI1143 TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
GAT27
Date:
Thu Oct 17 22:34:00 2013 +0000
Child:
1:a4c6fbb79eba
Commit message:
Simple test

Changed in this revision

SI1143.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SI1143.lib	Thu Oct 17 22:34:00 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/GAT27/code/SI1143/#cb3e8160f18e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Oct 17 22:34:00 2013 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 17 22:34:00 2013 +0000
@@ -0,0 +1,60 @@
+#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);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 17 22:34:00 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file