version one

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed wave_player

Files at this revision

API Documentation at this revision

Comitter:
Septimus
Date:
Tue Mar 25 03:08:09 2014 +0000
Parent:
0:82705a2c05d1
Commit message:
Final Version

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 82705a2c05d1 -r f35df38e9b16 main.cpp
--- a/main.cpp	Mon Mar 24 17:45:38 2014 +0000
+++ b/main.cpp	Tue Mar 25 03:08:09 2014 +0000
@@ -29,13 +29,21 @@
     
 while(1){
      
-        pc.printf("%8.2fV %8.2f in\n", volts, inches);
+        pc.printf("%8.2fV %8.2f in\n", volts, inches);     //If the Sonar needs to be checked for functionality
         adc = Sonr.read();           // read analog as a float
         volts = adc * 3.3;          // convert to volts
         inches = volts / 0.0064;    // 3.3V supply: 6.4mV per inch
     
+    
+    //The first condition is that if the Sonar detects an object less than 8 inches above, then the AngryCat.wav file will play
+    //through the speaker and the LCD display will access from its SD card the AngryCat.jpg file.
+    
+    
      if(inches < 8){  
             
+          //The below if statement runs only if the entire preceding if statement has run at least once. It ensures that when 
+          //the program runs, it only clears the screen when an image transition occurs.  
+            
          if(trigger != 0){
              LCD.cls();           
            }
@@ -49,6 +57,9 @@
     trigger=0;
     }
     
+  //The second condition is that if the Sonar detects an object between 8 inches to 12 inches above the Sonar, then the NervousCat.wav file will play
+  //through the speaker and the LCD will display from its SD card the NervousCat.jpg file.
+ 
     
     else if(inches >= 8 && inches < 12){  
     
@@ -65,6 +76,11 @@
     trigger=1;
     }
     
+    
+  //The last condition is that if the Sonar detects an object further than 12 inches above the Sonar, then the NiceCat.wav file will play
+  //through the speaker and the LCD will display from its SD card the NiceCat.jpg file.
+   
+    
     else if(inches > 12){
         
           if(trigger != 2){