Orla Gilson / Mbed 2 deprecated WeatherLogger

Dependencies:   BMP180 N5110 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

Go to the documentation of this file.
00001 /**
00002 @file main.h
00003 @brief header file containing functions and variables
00004 @brief Revision 1.0
00005 @author Orla Gilson
00006 @date May 2015
00007 */
00008 
00009 #ifndef MAIN_H
00010 #define MAIN_H
00011 #include "mbed.h"
00012 #include "BMP180.h"
00013 #include "N5110.h"
00014 #include "PowerControl/PowerControl.h"
00015 #include "PowerControl/EthernetPowerControl.h"
00016 
00017 /**
00018 @namespace lcd
00019 @brief bus output for Nokia 5110 LCD screen
00020 */
00021 N5110 lcd(p7,p8,p9,p10,p11,p13,p26);
00022 
00023 /**
00024 @namespace bmp180
00025 @brief serial input for BMP180 sensor
00026 */
00027 BMP180 bmp180(p28,p27);
00028 
00029 /**
00030 @namespace local
00031 @brief creates local file system to write files to
00032 */
00033 LocalFileSystem local("local");
00034 
00035 /**
00036 @namespace leds
00037 @brief bus output for the two centre on-board leds
00038 */
00039 BusOut leds(LED3,LED2);
00040 
00041 /**
00042 @namespace buttonleft
00043 @brief interrupt in function for the left hand button
00044 */
00045 InterruptIn buttonleft(p15);
00046 
00047 /**
00048 @namespace BUT2
00049 @brief analog in function for the right hand button
00050 */
00051 AnalogIn BUT2(p16);
00052 
00053 /**
00054 @namespace POT
00055 @brief analog in function for the potentiometer
00056 */
00057 AnalogIn POT(p20);
00058 
00059 /**
00060 @namespace led
00061 @brief GPIO output for error LED
00062 */
00063 DigitalOut led(p25);
00064 
00065 /**
00066 @namespace buzzer
00067 @brief PWM output for piezo buzzer
00068 */
00069 PwmOut buzzer(p21);
00070 
00071 /**
00072 @namespace LDR
00073 @brief analog input for the light dependant resistor
00074 */
00075 AnalogIn LDR(p17);
00076 
00077 /**
00078 Sets x axis of screen
00079 @param nx - length of x axis
00080 */
00081 int nx=84;
00082 
00083 /**
00084 Sets y axis of screen
00085 @param ny - length of y axis
00086 */
00087 int ny=48;
00088 
00089 /**
00090 Coordinates of a pixel
00091 @param i - x value of coordinate (0-83)
00092 @param j - y value of coordinate (0-47
00093 */
00094 int i,j;
00095 
00096 /**
00097 * initialising a decimal variable
00098 */
00099 float temperature;
00100 
00101 /**
00102 * initialising a decimal variable
00103 */
00104 float pressure;
00105 
00106 /** 
00107 * initialise the counter as an integer
00108 */
00109 int counter=0;
00110 
00111 /**
00112 * initialise the flag for the button
00113 */
00114 int buttonFlag=0;
00115 
00116 /**
00117 * timeout used for temperature
00118 */
00119 Timeout callT;
00120 
00121 /**
00122 * timeout used for pressure
00123 */
00124 Timeout callP;
00125 
00126 /**
00127 * timeout used for light
00128 */
00129 Timeout callL;
00130 
00131 /**
00132 * ticker function for temperature
00133 */
00134 Ticker timerT;
00135 
00136 /**
00137 * ticker function for pressure
00138 */
00139 Ticker timerP;
00140 
00141 /**
00142 * ticker function for error
00143 */
00144 Ticker timerE;
00145 
00146 /**
00147 * ticker function for light
00148 */
00149 Ticker timerL;
00150 
00151 /**
00152 * initialise flag for temperature
00153 */
00154 int timerTFlag = 0;
00155 
00156 /**
00157 * initialise flag for pressure
00158 */
00159 int timerPFlag = 0;
00160 
00161 /**
00162 * initialise flag for error
00163 */
00164 int timerEFlag = 0;
00165 
00166 /**
00167 * initialise flag for light
00168 */
00169 int timerLFlag = 0;
00170 
00171 /** Expire Timer T; 
00172 * timer associated with temperature; 
00173 * sets timerTFlag to one
00174 */
00175 void timerTExpired();
00176 
00177 /** Expire Timer P; 
00178 * timer associated with pressure; 
00179 * sets timerPFlag to one
00180 */
00181 void timerPExpired();
00182 
00183 /** Expire Timer E; 
00184 * timer associated with error LED; 
00185 * sets timerEFlag to one
00186 */
00187 void timerEExpired();
00188 
00189 /** Expire Timer L;
00190 * timer associated with error LED;
00191 * sets timerLFlag to one
00192 */
00193 void timerLEpired();
00194 
00195 /** Press Button; 
00196 * interrupt associated with left button; 
00197 * sets buttonFlag to one
00198 */
00199 void buttonPressed();
00200 
00201 /** Error Function; 
00202 * function supplies error function; 
00203 * LED lights up every 2 seconds; 
00204 * buzzer goes off simultaneously with the LED
00205 */
00206 void error();
00207 
00208 /** Write Data To File; 
00209 * function to write data to the flash drive
00210 */
00211 void writeDataToFile();
00212 
00213 /** Calls Temperature; 
00214 * function reads the temperature from the sensor; 
00215 * prints the current temperature to the screen
00216 */
00217 void callTemp();
00218 
00219 /** Calls Pressure; 
00220 * function reads the pressure from the sensor; 
00221 * prints the current pressure to the screen
00222 */
00223 void callPress();
00224 
00225 /** Calls Light; 
00226 * function reads the light from the LDR; 
00227 * prints the current temperature to the screen
00228 */
00229 void callLight();
00230 
00231 /** Read Temperature; 
00232 * calls callTemp after 0.1 seconds; 
00233 * reads temperature every 60 seconds; 
00234 * prints temperature to screen; 
00235 * updates screen every 60 seconds with new temperature
00236 */
00237 void readTemp();
00238 
00239 /** Read Pressure; 
00240 * calls callPress after 0.1 seconds; 
00241 * reads pressure every 30 minutes/1800 seconds; 
00242 * prints pressure to screen; 
00243 * updates screen every 30 minutes with new pressure
00244 */
00245 void readPress();
00246 
00247 /** Read Light; 
00248 * calls callLight after 0.1 seconds; 
00249 * reads light every 60 seconds; 
00250 * prints light to screen; 
00251 * updates screen every 60 seconds with new light
00252 */
00253 void readLight();
00254 
00255 /** Measurement; 
00256 * read measurement from sensor; 
00257 * set temperature; 
00258 * set pressure
00259 */
00260 void measurement();
00261 
00262 /** Temperature Graph; 
00263 * read temperature every 2 seconds; 
00264 * create temporary array; 
00265 * read temperature values into array; 
00266 * scale temperature array; 
00267 * plot array
00268 */
00269 void tempGraph();
00270 
00271 /** Pressure Graph; 
00272 * read pressure every 2 seconds; 
00273 * create temporary array; 
00274 * read pressure values into array; 
00275 * scale pressure array;
00276 * plot array
00277 */
00278 void pressGraph();
00279 
00280 /** Light Graph; 
00281 * read light every 2 seconds; 
00282 * create temporary array; 
00283 * read light values into array; 
00284 * scale light array; 
00285 * plot array
00286 */
00287 void lightGraph();
00288 
00289 /** Menu; 
00290 * print temperature screen if potentiometer is greater than 2/3; 
00291 * print pressure screen if potentiometer is between 1/3 and 2/3; 
00292 * print light screen if potentiometer is less than 1/3
00293 */
00294 void menu();
00295 
00296 /** Clear Cells; 
00297 * cycle through pixels and set to zero
00298 */
00299 void clearCells();
00300 
00301 #endif