an ultrasonic sensor used as a car sensor
Dependencies: N5110 PowerControl beep mbed sensor
main.h
- Committer:
- sjaffal3
- Date:
- 2015-05-08
- Revision:
- 1:475a5b7258fa
- Child:
- 2:9328053b2ba7
File content as of revision 1:475a5b7258fa:
/** @file main.h @brief Header file containing functions prototypes, defines and global variables. @brief Revision 1.0. @author Saleh Jaffal @date April 2015 */ #ifndef MAIN_H #define MAIN_H #include "mbed.h" #include "SRF02.h" #include "N5110.h" #include "beep.h" #include "PowerControl/PowerControl.h" #include "PowerControl/EthernetPowerControl.h" #define USR_POWERDOWN (0x104) N5110 lcd(p7,p8,p9,p10,p11,p13,p26); SRF02 sensor(p28, p27); /** @namespace buzzer @brief output for status buzzer */ Beep buzzer(p21); /** @namespace green1 @brief GPIO output for status LED */ PwmOut green1(p22); /** @namespace green2 @brief GPIO output for status LED */ PwmOut green2(p23); /** @namespace yellow1 @brief GPIO output for status LED */ PwmOut yellow1(p24); /** @namespace yellow2 @brief GPIO output for status LED */ PwmOut yellow2(p25); /** @namespace red1 @brief GPIO output for status LED */ DigitalOut red1(p29); /** @namespace red2 @brief GPIO output for status LED */ DigitalOut red2(p30); /** @namespace pot @brief GPIO input for lcd brightness */ AnalogIn pot(p20); /** @namespace button @brief GPIO input to switch values from the sensor */ InterruptIn button(p15); Serial pc(USBTX, USBRX); void welcomeMessage(); void getDistanceCm(); void getDistanceIn(); void getDistanceUs(); void getAcc(); void distanceA(); void distanceB(); void distanceC(); void distanceD(); void distanceE(); void distanceF(); void buttonPressed(); void compDist(); int distanceCm; int distanceIn; int distanceUs; /** All distances used to add the 10 readings from the sensor to get an average of 10 readings per second, so that it will cancel out the noise. */ int distance1; /*!< distance1 set in ISR */ int distance2; /*!< distance2 set in ISR */ int distance3; /*!< distance3 set in ISR */ int distance4; /*!< distance4 set in ISR */ int distance5; /*!< distance5 set in ISR */ int distance6; /*!< distance6 set in ISR */ int distance7; /*!< distance7 set in ISR */ int distance8; /*!< distance8 set in ISR */ int distance9; /*!< distance9 set in ISR */ int distance10; /*!< distance10 set in ISR */ int dist; int tim; int Vel1; int Vel2; int Acc; int i=0; int sum; #endif