countingstuffpoop?

Dependencies:   SI1143 m3pi mbed

Fork of Proximity_Sensor_2_sense by MF Doom

Files at this revision

API Documentation at this revision

Comitter:
dmcohen24
Date:
Fri May 23 21:35:11 2014 +0000
Parent:
1:73781ab8b05b
Child:
3:0359b918f658
Commit message:
Added bluetooth

Changed in this revision

SI1143.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
--- a/SI1143.lib	Tue May 20 21:34:10 2014 +0000
+++ b/SI1143.lib	Fri May 23 21:35:11 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/dmcohen24/code/SI1141/#70933bf445af
+http://mbed.org/users/dmcohen24/code/SI1141/#31d4e955ee92
--- a/main.cpp	Tue May 20 21:34:10 2014 +0000
+++ b/main.cpp	Fri May 23 21:35:11 2014 +0000
@@ -2,71 +2,40 @@
 #include "SI1143.h"
 
 SI1143 sensor(p28, p27);
+InterruptIn prox_meas(p29);
+Serial bt(p13, p14);
 
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
 DigitalOut led3(LED3);
 DigitalOut led4(LED4);
 
+int sense1;
+
+void meas_int(){
+    led1 = 1;
+    sense1 = sensor.read_ps1();
+    bt.printf("%d\r\n",sense1);
+    sensor.clear_int();
+}
+
 int main()
-{
-    int sense1;    
+{   
     // Setup the baseline
-    sensor.bias(1,10);
-    //wait(1);
+    // sensor.bias(1,10);
+    wait(3);
     //led2 = 0;
+    prox_meas.fall(&meas_int);
+    sensor.start_ps_auto();
     
     while(1)
     {
         // Read each led sensor
-        sense1 = sensor.get_ps1(1);
-        
-        // Can be changed for different sensitivity
-        //D1
-        if (sense1 > 30)
-        {
-            led1 = 1;    
-        }
-        else
-        {
-            led1 = 0;
-        }
-        
-       //D2  
-        
-        if (sense1 > 100)
-        {
-            led2 = 1;    
-        }
-        else
-        {
-            led2 = 0;
-        }
-        
-       //D3
-        
-        if (sense1 > 250)
-        {
-            led3 = 1;    
-        }
-        else
-        {
-            led3 = 0;
-        }
-        
-       //D4
-       
-        if (sense1 > 1000)
-        {
-            led4 = 1;    
-        }
-        else
-        {
-            led4 = 0;
-        } 
-        
+        //sense1 = sensor.get_ps1(1);
+                
         //Numeriacl output through terminal
-        printf("%d\r\n",sense1);
+        led1 = 0;
+        //printf("%d\r\n",sense1);
         
         //led2 = !led2;
         //wait(.01);