Emmanuel Adolphus / Mbed 2 deprecated Car_Parker

Dependencies:   N5110 PinDetect PowerControl SRF02 mbed

Embed: (wiki syntax)

« Back to documentation index

main.cpp File Reference

main.cpp File Reference

ELEC2645 Embedded Systems Project. More...

Go to the source code of this file.

Namespaces

namespace  Nokia
 

N5110 LCD, LEDs, Temperatuure Sensor, Distnce Sensor, Buzzer, Button.


Functions

void setBrightness (float brightness)
 By turning the potentiometer, this function allows you to control the LCD brightneess the potentiometer uses the 3.3V output from the mbed as its input and uses an analouge in to feedback to the mbed but it must be noted that the signal or voltage the mbed recieves is between 0V to 1V it can not read in anything above this from the potenteiometer.
void clearRAM ()
 This function writes a 0 to the 504 bytes to clear the RAM in other to reduce the current waste.
void setXYAddress (int x, int y)
 This function is used to set the X-Y address in RAM for futire data write to the LCD.
void resting ()
 This function "resting" contians codes which gets the distance from the sensor and displays it on the LCD Also still in this function other functions like the getTempearature are called as they all are display at same time on the screen And all the alerts both sound and virtual associated with the car parking aspect of the device are implement here.
void turnOfDisplay ()
 This turns of the LCD completely.
void initialise ()
 Here the LCD initialisation function is called and the welcome messages and also authors details are implmemet which runs only once whenever the device is powered on.
void setPixel ()
 This functions both the setPixel and drawLine function draws the horizontal line which acts as the floor or main road which the car is moving on.
void controlBrightness ()
 When the buton is pressed, this function enables the user to view the percentage of the brightness
void initTMP102 ()
 Function to initialise the temperature sensor.
void stopper ()
 Displays the temperature and also calls contains the alert messages for the temperature aspect of the device.
void firstImage ()
 This function is used to draw the vertical brick wall which show the limit the car sensor can car and to alert the driver that he or she is getting close to an object.
void p15Pressed (void)
 To clear the screen and prepare to show the date and time when the button is pressed.
void p15Released (void)
 The function is part of the PinDetect library which dose the callback function.
void timerInterrupt ()
 Functions to get and display the date.
void setter (int xVert, int xHor, int xVert2, int xHor2, int yVert, int yHor, int yVert2, int yHor2, int xVert3, int xHor3, int xVert4, int xHor4, int yVert3, int yHor3, int yVert4, int yHor4)
 This is declears variables which are later used to draw the moving car depending on the values of the x and y cordinates inputted.
void battery ()
 Function to draw the battery symbol, though at the time of this project a way of getting the battery life was not included but will be added in the next revision.
float getTemperature ()
 Function to the temperature from the Temearature sensor.
int semihost_powerdown ()
 to power Down the Ethernet
void tempTime ()
 Functions to get and display the time.
void error (int code)
 hangs in infinite loop flashing error code when something gors wrong for instance is the distance sensor was not detected

Variables

int buttonFlag = 0
 Creates a flag to be used by the button.
float frequency [] = {659,554}
 Defines the frequency of the pwm and the beat for sound and LED flashing for alerts.
int next [84][48]
 Defines the x,y pixels for the lcd display.
int distance = srf.getDistanceCm()
 Gets the distance measurement from the sensor.

Detailed Description

ELEC2645 Embedded Systems Project.

Ultrasonic Distance sensor/Car Parker Designed to help car owners park thier cars more effectively it basically uses burst of sound waves to measure the distance of objects from the device Revision 1.0

Author:
Adolphus George Emmanuel
Date:
May 2015

Definition in file main.cpp.


Function Documentation

void battery (  )

Function to draw the battery symbol, though at the time of this project a way of getting the battery life was not included but will be added in the next revision.

Definition at line 785 of file main.cpp.

void clearRAM (  )

This function writes a 0 to the 504 bytes to clear the RAM in other to reduce the current waste.

Definition at line 312 of file main.cpp.

void controlBrightness (  )

When the buton is pressed, this function enables the user to view the percentage of the brightness

Definition at line 743 of file main.cpp.

void error ( int  code )

hangs in infinite loop flashing error code when something gors wrong for instance is the distance sensor was not detected

Definition at line 652 of file main.cpp.

void firstImage (  )

This function is used to draw the vertical brick wall which show the limit the car sensor can car and to alert the driver that he or she is getting close to an object.

Definition at line 470 of file main.cpp.

float getTemperature (  )

Function to the temperature from the Temearature sensor.

Definition at line 699 of file main.cpp.

void initialise (  )

Here the LCD initialisation function is called and the welcome messages and also authors details are implmemet which runs only once whenever the device is powered on.

Definition at line 544 of file main.cpp.

void initTMP102 (  )

Function to initialise the temperature sensor.

Definition at line 665 of file main.cpp.

void p15Pressed ( void   )

To clear the screen and prepare to show the date and time when the button is pressed.

Definition at line 718 of file main.cpp.

void p15Released ( void   )

The function is part of the PinDetect library which dose the callback function.

Definition at line 729 of file main.cpp.

void resting (  )

This function "resting" contians codes which gets the distance from the sensor and displays it on the LCD Also still in this function other functions like the getTempearature are called as they all are display at same time on the screen And all the alerts both sound and virtual associated with the car parking aspect of the device are implement here.

for PWM out code for buzzer sound,

See also:
https://developer.mbed.org/media/uploads/phill/mbed_course_notes_-_pulse_width_modulation.pdf

Definition at line 330 of file main.cpp.

int semihost_powerdown (  )

to power Down the Ethernet

Definition at line 159 of file main.cpp.

void setBrightness ( float  brightness )

By turning the potentiometer, this function allows you to control the LCD brightneess the potentiometer uses the 3.3V output from the mbed as its input and uses an analouge in to feedback to the mbed but it must be noted that the signal or voltage the mbed recieves is between 0V to 1V it can not read in anything above this from the potenteiometer.

Definition at line 264 of file main.cpp.

void setPixel (  )

This functions both the setPixel and drawLine function draws the horizontal line which acts as the floor or main road which the car is moving on.

Definition at line 232 of file main.cpp.

void setter ( int  xVert,
int  xHor,
int  xVert2,
int  xHor2,
int  yVert,
int  yHor,
int  yVert2,
int  yHor2,
int  xVert3,
int  xHor3,
int  xVert4,
int  xHor4,
int  yVert3,
int  yHor3,
int  yVert4,
int  yHor4 
)

This is declears variables which are later used to draw the moving car depending on the values of the x and y cordinates inputted.

Definition at line 486 of file main.cpp.

void setXYAddress ( int  x,
int  y 
)

This function is used to set the X-Y address in RAM for futire data write to the LCD.

Definition at line 214 of file main.cpp.

void stopper (  )

Displays the temperature and also calls contains the alert messages for the temperature aspect of the device.

Definition at line 626 of file main.cpp.

void tempTime (  )

Functions to get and display the time.

Definition at line 568 of file main.cpp.

void timerInterrupt (  )

Functions to get and display the date.

Definition at line 591 of file main.cpp.

void turnOfDisplay (  )

This turns of the LCD completely.

Definition at line 252 of file main.cpp.


Variable Documentation

int buttonFlag = 0

Creates a flag to be used by the button.

Returns:
an integer

Definition at line 62 of file main.cpp.

int distance = srf.getDistanceCm()

Gets the distance measurement from the sensor.

Definition at line 89 of file main.cpp.

float frequency[] = {659,554}

Defines the frequency of the pwm and the beat for sound and LED flashing for alerts.

Parameters:
frequncy- float for frequency
beat- to set the tempo
See also:
https://developer.mbed.org/media/uploads/phill/mbed_course_notes_-_pulse_width_modulation.pdf

Definition at line 74 of file main.cpp.

int next[84][48]

Defines the x,y pixels for the lcd display.

Definition at line 80 of file main.cpp.