Simple Electronic Angle Meter and Spirit Level.

Dependencies:   MMA8452 mbed

Revision:
1:f167423f6f0c
Parent:
0:2885d4453e88
diff -r 2885d4453e88 -r f167423f6f0c main.cpp
--- a/main.cpp	Mon May 11 12:24:48 2015 +0000
+++ b/main.cpp	Mon May 11 13:15:33 2015 +0000
@@ -1,6 +1,6 @@
 /**
 @file main.cpp
-@brief Electronic Angle Meter and Gradienter.
+@brief Electronic Angle Meter and Spirit Level.
 @brief Revision 1.0.
 @author Shengyuan Chu
 @date May 2015
@@ -37,16 +37,16 @@
 */
 void Switch (int functoion);           
 void AngleMeter();
-void Gradienter();
+void SpiritLevel();
 void fun1();
 void fun2();
 
 /**
 @brief Different frequencies of buzzer.
 */
-float frequency1 = 440;
-float frequency2 = 554;
-float frequency3 = 659;
+float frequency1 = 1046.5;
+float frequency2 = 1174.7;
+float frequency3 = 1318.5;
 
 /**
 @brief Main function.
@@ -95,7 +95,7 @@
 }
 
 /**
-@brief Switch functions between Angle Meter and Gradienter.
+@brief Switch functions between Angle Meter and Spirit Level.
 @param function - integer to change between 1 and 2.
 @return Call fun1() when function=2, call fun2() when function=1.
 */   
@@ -271,7 +271,7 @@
 @brief Indicate the gradient in all directions by showing
 @brief the position of a group of pixes.
 */
-void Gradienter()
+void SpiritLevel()
 {
     /**Initialise all the LEDs to be off.*/  
     ledA=0;
@@ -288,7 +288,7 @@
     mma8452.init();    
     Acceleration acceleration; 
 
-    /**When button is not pushed, main features of Gradienter will be run.*/       
+    /**When button is not pushed, main features of Spirit Level will be run.*/       
     while(!pb) {        
         
         /**Read value of acceleration.*/
@@ -405,7 +405,7 @@
 }
 
 /**
-@brief Display the function name of Gradienter for 1 second before calling it.
+@brief Display the function name of Spirit Level for 1 second before calling it.
 */          
 void fun2()
 {
@@ -418,9 +418,9 @@
     lcd.setBrightness(0.8);
     lcd.clear();
     
-    /**Display the function name of Gradienter.*/     
+    /**Display the function name of Spirit Level.*/     
     lcd.printString("Electronic",12,2);
-    lcd.printString("Gradienter",12,3);
+    lcd.printString("Spirit Level",7,3);
 
     /**Turn LED B and LED D on.*/                 
     ledA=0;
@@ -428,8 +428,8 @@
     ledC=0;
     ledD=1;
 
-    /**Call function of Gradienter after 1 second delay.*/           
-    flipper.attach(&Gradienter, 1.0);       
+    /**Call function of Spirit Level after 1 second delay.*/           
+    flipper.attach(&SpiritLevel, 1.0);       
 }
 
 /**