Coding for vehicle rear assistant

Dependencies:   beep mbed

Fork of Vehicle_Rear_Assistant by amin omar

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  lcd
 

GPIO pins for LCD display.


namespace  sensor
 

GPIO pins for SRF02.


namespace  buzzer
 

PWM pin for piezo buzzer.


namespace  danger
 

PWM pin for RED LED.


namespace  caution
 

PWM pin for YELLOW LED.


namespace  safe
 

PWM pin for GREEN LED.


namespace  lcdBrightness
 

PWM pin for LCD backlight.


namespace  potBrightness
 

AnalogIn pin for potentiometer.


namespace  button
 

InterruptIn pin for button.


Functions

void welcomeText ()
 Print welcome message when switch is turned on.
void getDistance ()
 Measure distance between car and objects.
void readDistance ()
 Print "CAR" and a block on LCD according to distance measured.
void distanceSafe ()
 This function is called when in safe mode.
void distanceCaution ()
 This function is called when in caution mode.
void distanceDanger ()
 This function is called when in danger mode.
void buttonPressed ()
 This function is called when button is pressed.

Variables

int distance
int buttonFlag = 0
int displayReading = 0

Detailed Description

Header file containing functions prototypes, defines and global variables.

The software of Vehicle Rear Assistant. ELEC 2645

Author:
Aminuddin Omar
Date:
APRIL 2015

Definition in file main.h.


Function Documentation

void buttonPressed (  )

This function is called when button is pressed.

Parameters:
buttonFlag- set the button flag to 1

Definition at line 249 of file main.h.

void distanceCaution (  )

This function is called when in caution mode.

Parameters:
safe- only YELLOW LED light up buzzer is called and beep according to distance

Definition at line 226 of file main.h.

void distanceDanger (  )

This function is called when in danger mode.

Parameters:
safe- only RED LED light up buzzer is called and beep according to distance

Definition at line 237 of file main.h.

void distanceSafe (  )

This function is called when in safe mode.

Parameters:
safe- only GREEN LED light up buzzer is called and beep according to distance

Definition at line 215 of file main.h.

void getDistance (  )

Measure distance between car and objects.

Parameters:
distance- use SRF02 to measure distance

Definition at line 149 of file main.h.

void readDistance (  )

Print "CAR" and a block on LCD according to distance measured.

Parameters:
lcd.drawRect- draw rectangle to represent object
lcd.printString- draw "CAR" to represent car
lcd.refresh()- refresh LCD display
distanceSafe()- GREEN LED and buzzer is activated in safe mode
distanceCaution()- YELLOW LED and buzzer is activated in caution mode
distanceDanger()- RED LED and buzzer is activated in danger mode

Definition at line 155 of file main.h.

void welcomeText (  )

Print welcome message when switch is turned on.

Parameters:
a- set number of letters that can be written including space
message- Print HELLO
rear- Print REAR
assistant- Print ASSISTANT
name- Print A.OMAR
number- Print 200906568

Definition at line 115 of file main.h.


Variable Documentation

int buttonFlag = 0

print flag set in ISR

Definition at line 53 of file main.h.

int displayReading = 0

display the value of distance on LCD

Definition at line 54 of file main.h.

int distance

measure distance between car and object

Definition at line 52 of file main.h.