Simple Electronic Angle Meter and Spirit Level.
Electronic Angle Meter and Spirit Level. More...
Go to the source code of this file.
Functions | |
| void | Switch (int functoion) |
| Function prototypes. | |
| void | AngleMeter () |
| Display angles in two dimensions and indicate directions using arrows. | |
| void | SpiritLevel () |
| Indicate the gradient in all directions by showing. | |
| void | fun1 () |
| Display the function name of Angle Meter for 1 second before calling it. | |
| void | fun2 () |
| Display the function name of Spirit Level for 1 second before calling it. | |
| int | main () |
| Main function. | |
| void | PHY_PowerDown () |
| Power down the Ethernet interface to save power. | |
Variables | |
| N5110 | lcd (p7, p8, p9, p10, p11, p13, p26) |
| Connect all components to mbed LPC1768. | |
| float | frequency1 = 1046.5 |
| Different frequencies of buzzer. | |
Detailed Description
Electronic Angle Meter and Spirit Level.
Revision 1.0.
- Date:
- May 2015
Definition in file main.cpp.
Function Documentation
| void AngleMeter | ( | ) |
Display angles in two dimensions and indicate directions using arrows.
Initialise the accelerometer.
Lower down the brightness of LCD to 0.5.
When button is not pushed, main features of Angle Meter will be run.
Display 'degree' in the last line of LCD.
Read value of acceleration.
Calculate the angles in X and Y dimensions.
Print formatted data to buffer.
Display values if string will fit on display.
LED C will be turned on if the angle in X dimension is larger than 20 degree.
LED A will be turned on if the angle in X dimension is smaller than -20 degree.
LED D will be turned on if the angle in Y dimension is larger than 20 degree.
LED B will be turned on if the angle in Y dimension is smaller than -20 degree.
Draw lines of the body of arrows.
Pixes will be set if the angle in Y dimension is larger than 0 degree.
Pixes will be set if the angle in Y dimension is smaller than 0 degree.
Pixes will be set if the angle in X dimension is larger than 0 degree.
Pixes will be set if the angle in X dimension is smaller than 0 degree.
Decrease the fluctuation of values.
Buzzer will beep in frequency 2 if the angle is between 50 and 75 degree.
Buzzer will beep in frequency 3 if the angle is beyond 75 degree.
Buzzer will not beep.
When button is pushed, main features will stop.
| void fun1 | ( | ) |
| void fun2 | ( | ) |
Display the function name of Spirit Level for 1 second before calling it.
Turn off the buzzer.
Initialise the LCD and set brightness to 0.8.
Display the function name of Spirit Level.
Turn LED B and LED D on.
Call function of Spirit Level after 1 second delay.
| int main | ( | ) |
Main function.
Call function of Angle Meter without pushing button when power is initally turned on.
Power down Ethernet interface to save power.
Initialise LCD and set brightness to 0.8.
Display the name of Angle Meter function after the initialization of LCD.
Call function of Angle Meter after 2 seconds' delay.
Turn all the LEDs on when the power is initially turned on.
Set button to PullDown mode.
Change the integer between 1 and 2 when button is pressed and send it to Switch function.
Allow 0.2 second for button debounce.
| void PHY_PowerDown | ( | void | ) |
| void SpiritLevel | ( | ) |
Indicate the gradient in all directions by showing.
the position of a group of pixes.
Initialise all the LEDs to be off.
Set the LCD to inverse mode and lower down the brightness to 0.5.
Initialise the accelerometer.
When button is not pushed, main features of Spirit Level will be run.
Read value of acceleration.
Draw three circles and two lines.
Pixes will be displayed if acceleration values are within -0.4 and 0.4.
Displayed pixes will be cleared after 0.2 second.
All LEDs will be turned on if acceleration values are within -0.05 and 0.05.
All LEDs will be turned off if acceleration values go beyond this range.
| void Switch | ( | int | function ) |
Variable Documentation
| float frequency1 = 1046.5 |
Generated on Tue Jul 12 2022 14:28:55 by
1.7.2