Andreas Konstantinou / Mbed 2 deprecated ParkingSensor

Dependencies:   N5110 PowerControl SRF02 beep mbed

Embed: (wiki syntax)

« Back to documentation index

main.h File Reference

main.h File Reference

Header file containing functions prototypes, defines and global variables. More...

Go to the source code of this file.

Namespaces

namespace  srf02
 

ultrasonic distance sensor connects to I2C pins SDA and SCL


namespace  leds
 

The four LEDs on mbed.


namespace  lcd
 

NOKIA 5110 LCD display.


namespace  buzzer
 

a piezo buzzer connected to PWM pin


namespace  led_red
 

Red led connected to PWM pin for brightness.


namespace  led_yellow
 

Yellowonnected to PWM pin for brightness.


namespace  led_green
 

Green led connected to PWM pin for brightness.


namespace  ain2
 

Analog input for the potentiometer to control the frequency of the buzzer.


namespace  ain1
 

Analog input for the potentiometer to control the brightness of the lcd.


namespace  button_1
 

Set button_1 to be interrupt, coonected to GPIO.


namespace  button_2
 

set button_2 to be interrupt, coonected to GPIO


namespace  button_3
 

set button_3 to be interrupt, coonected to GPIO


namespace  button_4
 

set button_4 to be interrupt, coonected to GPIO


namespace  timer_red
 

ticker object used to control the time of red LED


namespace  timer_yellow
 

ticker object used to control the time of yellow LED


namespace  timer_green
 

ticker object used to control the time of green LED


Functions

void Get_Average ()
 Get Avegare distance.
void timerExpired_red ()
 Timer Expired red led.
void button1_Pressed ()
 Button1 Pressed.
void button2_Pressed ()
 Button2 Pressed.
void button3_Pressed ()
 Button3 Pressed.
void button4_Pressed ()
 Button4 Pressed.
void timerExpired_yellow ()
 Timer Expired yellow led.
void timerExpired_green ()
 Timer Expired green led.
void ButtonsOperation ()
 Check states of the buttons.
void buttonOperation_1 ()
 Check state of button 1.
void buttonOperation_2 ()
 Check state of button 2.
void buttonOperation_3 ()
 Check state of button 3.
void buttonOperation_4 ()
 Check state of button 4.
void Print_Time_Date ()
 Print Current Time and Date.

Variables

int timerflag_red = 0
int timerflag_yellow = 0
int timerflag_green = 0
int setTimeFlag = 0
int button1_flag = 0
int button2_flag = 0
int button3_flag = 0
int button4_flag = 0
char buffer [5]
float a1
float a2
float distance = 0
float Distance_Array [5]

Detailed Description

Header file containing functions prototypes, defines and global variables.

Reverse Parking Sensor

Author:
Andreas Konstantinou
Date:
April 2015

Definition in file main.h.


Function Documentation

void button1_Pressed (  )

Button1 Pressed.

This function sets the flag of button 1 to high

Definition at line 31 of file main.cpp.

void button2_Pressed (  )

Button2 Pressed.

This function sets the flag of button 2 to high

Definition at line 35 of file main.cpp.

void button3_Pressed (  )

Button3 Pressed.

This function sets the flag of button 3 to high

Definition at line 39 of file main.cpp.

void button4_Pressed (  )

Button4 Pressed.

This function sets the flag of button 4 to high

Definition at line 43 of file main.cpp.

void buttonOperation_1 (  )

Check state of button 1.

This function checks the state of the button 1. if button1 is pressed then the leds and buzzer start blinking and making sound,repsectively, based on the measurements of the sensor

Definition at line 79 of file main.cpp.

void buttonOperation_2 (  )

Check state of button 2.

This functions checks the status of the button 2. if it is pressed then converts the units of the sensor's measurements from meters to centimeters and displays them on the lcd

Definition at line 158 of file main.cpp.

void buttonOperation_3 (  )

Check state of button 3.

This functions checks the status of the button 3. if it is pressed then a new pattern is showed in the lcd and displays the measured distance.

Definition at line 230 of file main.cpp.

void buttonOperation_4 (  )

Check state of button 4.

This functions checks the status of the button 4. if it is pressed then a new pattern is displayed on lcd and displays the sensor's measurements

Definition at line 440 of file main.cpp.

void ButtonsOperation (  )

Check states of the buttons.

This function checks the status between the buttons 2, 3, and 4 and based on the status of each one then executes the appropiate process

Definition at line 522 of file main.cpp.

void Get_Average (  )

Get Avegare distance.

This function gets the avegare distance of 5 values of the sensor

Definition at line 8 of file main.cpp.

void Print_Time_Date (  )

Print Current Time and Date.

This function sets the current time and date and prints them on the dispaly

Definition at line 48 of file main.cpp.

void timerExpired_green (  )

Timer Expired green led.

This function sets the flag of the green led to high

Definition at line 74 of file main.cpp.

void timerExpired_red (  )

Timer Expired red led.

This function sets the flag of the red led to high

Definition at line 64 of file main.cpp.

void timerExpired_yellow (  )

Timer Expired yellow led.

This function sets the flag of the yellow led to high

Definition at line 69 of file main.cpp.


Variable Documentation

float a1

a1 used to control the brightness of the LED background display by getting the value of the potentiometer1

Definition at line 214 of file main.h.

float a2

a2 used to control the frequency of the buzzer by getting the value of the potentiometer2

Definition at line 215 of file main.h.

char buffer[5]

buffer used to display characters on lcd, each character is 6 pixels wide, screen is 84 pixels (84/6 = 14maximum)

Definition at line 213 of file main.h.

int button1_flag = 0

button 1 flag set in ISR

Definition at line 209 of file main.h.

int button2_flag = 0

button 2 flag set in ISR

Definition at line 210 of file main.h.

int button3_flag = 0

button 3 flag set in ISR

Definition at line 211 of file main.h.

int button4_flag = 0

button 4 flag set in ISR

Definition at line 212 of file main.h.

float distance = 0

this global variable used to get the average of 5 values of sensor

Definition at line 216 of file main.h.

float Distance_Array[5]

Distance_Array used to store 5 values of the sensor

Definition at line 217 of file main.h.

int setTimeFlag = 0

time flag set in ISR

Definition at line 208 of file main.h.

int timerflag_green = 0

timer flag green LED set in ISR

Definition at line 207 of file main.h.

int timerflag_red = 0

timer flag red LED set in ISR

Definition at line 205 of file main.h.

timer flag yellow LED set in ISR

Definition at line 206 of file main.h.