an ultrasonic sensor used as a car sensor

Dependencies:   N5110 PowerControl beep mbed sensor

Revision:
2:9328053b2ba7
Parent:
1:475a5b7258fa
--- a/main.h	Fri May 08 15:41:29 2015 +0000
+++ b/main.h	Mon May 11 19:49:17 2015 +0000
@@ -8,17 +8,15 @@
 
 #ifndef MAIN_H
 #define MAIN_H
-
+//#include "beep.h"
 #include "mbed.h"
 #include "SRF02.h"
 #include "N5110.h"
-#include "beep.h"
+#include "beep.h" ///@see a library I found to initiate the buzzer 
 #include "PowerControl/PowerControl.h"
 #include "PowerControl/EthernetPowerControl.h"
 
 #define USR_POWERDOWN (0x104)
-
-
 N5110 lcd(p7,p8,p9,p10,p11,p13,p26);
 SRF02 sensor(p28, p27);
 /**  
@@ -60,7 +58,7 @@
 @namespace pot
 @brief GPIO input for lcd brightness
 */
-AnalogIn pot(p20);
+AnalogIn mypot(p20);
 /**  
 @namespace button
 @brief GPIO input to switch values from the sensor
@@ -70,24 +68,56 @@
 
 Serial pc(USBTX, USBRX);
 
-void welcomeMessage();
-void getDistanceCm();
-void getDistanceIn();
-void getDistanceUs();
-void getAcc();
-void distanceA();
-void distanceB();
-void distanceC();
-void distanceD();
-void distanceE();
-void distanceF();
-void buttonPressed();
-void compDist();
 
 
-int distanceCm;
-int distanceIn;
-int distanceUs;
+void beepOff();
+
+void beepOn(float t);
+
+/**
+Shows the welcome message when the LCD is on
+*/
+void welcomeMessage();
+/**
+gets the distance in cm by dividing 
+10 read values by 10
+@returns the average distance in cm
+*/
+void getDistanceCm();
+/**
+gets the distance in inches by dividing 
+10 read values by 10
+@returns the average distance in inches
+*/
+void getDistanceIn();
+/**
+gets the distance in us by dividing 
+10 read values by 10
+@returns the average distance in us
+*/
+void getDistanceUs();
+
+/**
+when the button is pressed this 
+action is called
+*/
+void buttonPressed();
+/**
+looks for where the range of the reading is 
+to set its conditions
+*/
+void compDist();
+/**
+compares the cases of each distance
+to set the Led's values and the buzzer
+*/
+void distanceA();
+
+
+int distanceCm; /*!< distanceCm set in ISR */
+int distanceIn; /*!< distanceIn set in ISR */
+int distanceUs; /*!< distanceUs set in ISR */
+int A;   /*!< used to compare the cases after being set in compDist() */
 
 /**
 All distances used to add 
@@ -96,7 +126,6 @@
 per second, so that it will cancel 
 out the noise.
 */
-
 int distance1;   /*!< distance1 set in ISR */
 int distance2;   /*!< distance2 set in ISR */
 int distance3;   /*!< distance3 set in ISR */
@@ -107,12 +136,10 @@
 int distance8;   /*!< distance8 set in ISR */
 int distance9;   /*!< distance9 set in ISR */
 int distance10;  /*!< distance10 set in ISR */
-int dist;
-int tim;
-int Vel1;
-int Vel2;
-int Acc;
+
+float mypotVal;  /*!< mypotVal is used to transfer the vlaue of the pot
+                       to lcd brightness */
 int i=0;
-int sum;
-
+int sum; /*!< used to add all the distances together (ie distance 1,
+          distance 2, ...*/
 #endif
\ No newline at end of file