Robot that currently does nothing

Dependencies:   4DGL-uLCD-SE SDFileSystem ShiftBrite mbed-rtos mbed wave_player Motor

Revision:
5:6ca141fc6c4e
Parent:
4:589e4a2028a7
Child:
6:21c5a7cf63de
--- a/main.cpp	Wed Mar 15 05:30:37 2017 +0000
+++ b/main.cpp	Wed Mar 15 05:45:22 2017 +0000
@@ -23,6 +23,7 @@
 //ShiftBrite myBrite(p15,p16,spi); //latch, enable, spi
 SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card
 AnalogOut DACout(p18);      //must be p18
+AnalogIn IR(p20);
 //RawSerial BT(p9, p10);  //bluetooth pinout
 FILE *wave_file = NULL;         //global bc its gotta be changed by Main while running in child thread
 wave_player waver(&DACout);     //create wave_player object for speaker
@@ -50,16 +51,28 @@
         fclose(wave_file);  
     }
 }
+
 int main() {
     //thread1.start(IR_thread); // read in IR data
     thread2.start(LCD_thread1);   
     //thread3.start(Motor_thread);
     thread4.start(sound_thread);
     
-    while(1){   // poor coding practice, I know
-    
+    while(1){
+        //IR testing
+        if(IR>0.3 && IR<0.5) {
+            led1=1;
+            led2=led3=led4=0;
+        } else if (IR>0.5 && IR< 0.7) {
+            led1=led2=1;
+            led3=led4=0;
+        } else if (IR>0.7 && IR<0.9) {
+            led1=led2=led3=1;
+            led4=0;
+        } else if (IR>0.95) { //collision threshold seems to be the same from IR=0.8 to IR=0.95
+            led1=led2=led3=led4=1;    
+        } else led1=led2=led3=led4=0;
     }
     // use mutex to lock getc(), printf(), scanf()
     // don't unlock until you've checked that it's readable()  
-
 }
\ No newline at end of file