Orla Gilson / Mbed 2 deprecated WeatherLogger

Dependencies:   BMP180 N5110 mbed

Committer:
orlagilson
Date:
Thu May 07 16:11:21 2015 +0000
Revision:
5:3246c4b8362c
Child:
6:1b5603fd1a9c
Sixth commit, doxygen commenting begun, all functions done.; Variables need to be completed.; Light measurements need to be added.; Error function partially added, LED works as designed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
orlagilson 5:3246c4b8362c 1 /**
orlagilson 5:3246c4b8362c 2 @file main.h
orlagilson 5:3246c4b8362c 3 @brief header file containing functions and variables
orlagilson 5:3246c4b8362c 4 @brief Revision 1.0
orlagilson 5:3246c4b8362c 5 @author Orla Gilson
orlagilson 5:3246c4b8362c 6 @date May 2015
orlagilson 5:3246c4b8362c 7 */
orlagilson 5:3246c4b8362c 8
orlagilson 5:3246c4b8362c 9 #ifndef MAIN_H
orlagilson 5:3246c4b8362c 10 #define MAIN_H
orlagilson 5:3246c4b8362c 11 #include "mbed.h"
orlagilson 5:3246c4b8362c 12
orlagilson 5:3246c4b8362c 13 /**
orlagilson 5:3246c4b8362c 14 @namespace lcd
orlagilson 5:3246c4b8362c 15 @brief bus output for Nokia 5110 LCD screen
orlagilson 5:3246c4b8362c 16 */
orlagilson 5:3246c4b8362c 17 N5110 lcd(p7,p8,p9,p10,p11,p13,p26);
orlagilson 5:3246c4b8362c 18
orlagilson 5:3246c4b8362c 19 /**
orlagilson 5:3246c4b8362c 20 @namespace bmp180
orlagilson 5:3246c4b8362c 21 @brief serial input for BMP180 sensor
orlagilson 5:3246c4b8362c 22 */
orlagilson 5:3246c4b8362c 23 BMP180 bmp180(p28,p27);
orlagilson 5:3246c4b8362c 24
orlagilson 5:3246c4b8362c 25 /**
orlagilson 5:3246c4b8362c 26 @namespace buttonleft
orlagilson 5:3246c4b8362c 27 @brief interrupt in function for the left hand button
orlagilson 5:3246c4b8362c 28 */
orlagilson 5:3246c4b8362c 29 InterruptIn buttonleft(p15);
orlagilson 5:3246c4b8362c 30
orlagilson 5:3246c4b8362c 31 /**
orlagilson 5:3246c4b8362c 32 @namespace BUT2
orlagilson 5:3246c4b8362c 33 @brief analog in function for the right hand button
orlagilson 5:3246c4b8362c 34 */
orlagilson 5:3246c4b8362c 35 AnalogIn BUT2(p16);
orlagilson 5:3246c4b8362c 36
orlagilson 5:3246c4b8362c 37 /**
orlagilson 5:3246c4b8362c 38 @namespace POT
orlagilson 5:3246c4b8362c 39 @brief analog in function for the potentiometer
orlagilson 5:3246c4b8362c 40 */
orlagilson 5:3246c4b8362c 41 AnalogIn POT(p20);
orlagilson 5:3246c4b8362c 42
orlagilson 5:3246c4b8362c 43 /**
orlagilson 5:3246c4b8362c 44 @namespace led
orlagilson 5:3246c4b8362c 45 @brief GPIO output for error LED
orlagilson 5:3246c4b8362c 46 */
orlagilson 5:3246c4b8362c 47 DigitalOut led(p25);
orlagilson 5:3246c4b8362c 48
orlagilson 5:3246c4b8362c 49 /**
orlagilson 5:3246c4b8362c 50 Sets x axis of screen
orlagilson 5:3246c4b8362c 51 @param nx - length of x axis
orlagilson 5:3246c4b8362c 52 */
orlagilson 5:3246c4b8362c 53 int nx=84;
orlagilson 5:3246c4b8362c 54
orlagilson 5:3246c4b8362c 55 /**
orlagilson 5:3246c4b8362c 56 Sets y axis of screen
orlagilson 5:3246c4b8362c 57 @param ny - length of y axis
orlagilson 5:3246c4b8362c 58 */
orlagilson 5:3246c4b8362c 59 int ny=48;
orlagilson 5:3246c4b8362c 60
orlagilson 5:3246c4b8362c 61 /**
orlagilson 5:3246c4b8362c 62 Coordinates of a pixel
orlagilson 5:3246c4b8362c 63 @param i - x value of coordinate (0-83)
orlagilson 5:3246c4b8362c 64 @param j - y value of coordinate (0-47
orlagilson 5:3246c4b8362c 65 */
orlagilson 5:3246c4b8362c 66 int i,j;
orlagilson 5:3246c4b8362c 67
orlagilson 5:3246c4b8362c 68
orlagilson 5:3246c4b8362c 69 float temperature;
orlagilson 5:3246c4b8362c 70 float pressure;
orlagilson 5:3246c4b8362c 71 int buttonFlag=0;
orlagilson 5:3246c4b8362c 72 Timeout callT;
orlagilson 5:3246c4b8362c 73 Timeout callP;
orlagilson 5:3246c4b8362c 74 Ticker timerT;
orlagilson 5:3246c4b8362c 75 Ticker timerP;
orlagilson 5:3246c4b8362c 76 Ticker timerE;
orlagilson 5:3246c4b8362c 77 int timerTFlag = 0;
orlagilson 5:3246c4b8362c 78 int timerPFlag = 0;
orlagilson 5:3246c4b8362c 79 int timerEFlag = 0;
orlagilson 5:3246c4b8362c 80
orlagilson 5:3246c4b8362c 81
orlagilson 5:3246c4b8362c 82 /** Expire Timer T;
orlagilson 5:3246c4b8362c 83 * timer associated with temperature;
orlagilson 5:3246c4b8362c 84 * sets timerTFlag to one
orlagilson 5:3246c4b8362c 85 */
orlagilson 5:3246c4b8362c 86 void timerTExpired();
orlagilson 5:3246c4b8362c 87
orlagilson 5:3246c4b8362c 88 /** Expire Timer P;
orlagilson 5:3246c4b8362c 89 * timer associated with pressure;
orlagilson 5:3246c4b8362c 90 * sets timerPFlag to one
orlagilson 5:3246c4b8362c 91 */
orlagilson 5:3246c4b8362c 92 void timerPExpired();
orlagilson 5:3246c4b8362c 93
orlagilson 5:3246c4b8362c 94 /** Expire Timer E;
orlagilson 5:3246c4b8362c 95 * timer associated with error LED;
orlagilson 5:3246c4b8362c 96 * sets timerEFlag to one
orlagilson 5:3246c4b8362c 97 */
orlagilson 5:3246c4b8362c 98 void timerEExpired();
orlagilson 5:3246c4b8362c 99
orlagilson 5:3246c4b8362c 100 /** Press Button;
orlagilson 5:3246c4b8362c 101 * interrupt associated with left button;
orlagilson 5:3246c4b8362c 102 * sets buttonFlag to one
orlagilson 5:3246c4b8362c 103 */
orlagilson 5:3246c4b8362c 104 void buttonPressed();
orlagilson 5:3246c4b8362c 105
orlagilson 5:3246c4b8362c 106 /** Error Function;
orlagilson 5:3246c4b8362c 107 * function supplies error function;
orlagilson 5:3246c4b8362c 108 * LED lights up every 2 seconds;
orlagilson 5:3246c4b8362c 109 * buzzer goes off simultaneously with the LED
orlagilson 5:3246c4b8362c 110 */
orlagilson 5:3246c4b8362c 111 void error();
orlagilson 5:3246c4b8362c 112
orlagilson 5:3246c4b8362c 113 /** Calls Temperature;
orlagilson 5:3246c4b8362c 114 * function reads the temperature from the sensor;
orlagilson 5:3246c4b8362c 115 * prints the current temperature to the screen
orlagilson 5:3246c4b8362c 116 */
orlagilson 5:3246c4b8362c 117 void callTemp();
orlagilson 5:3246c4b8362c 118
orlagilson 5:3246c4b8362c 119 /** Calls Pressure;
orlagilson 5:3246c4b8362c 120 * function reads the pressure from the sensor;
orlagilson 5:3246c4b8362c 121 * prints the current pressure to the screen
orlagilson 5:3246c4b8362c 122 */
orlagilson 5:3246c4b8362c 123 void callPress();
orlagilson 5:3246c4b8362c 124
orlagilson 5:3246c4b8362c 125 /** Read Temperature;
orlagilson 5:3246c4b8362c 126 * calls callTemp after 0.1 seconds;
orlagilson 5:3246c4b8362c 127 * reads temperature every 60 seconds;
orlagilson 5:3246c4b8362c 128 * prints temperature to screen;
orlagilson 5:3246c4b8362c 129 * updates screen every 60 seconds with new temperature
orlagilson 5:3246c4b8362c 130 */
orlagilson 5:3246c4b8362c 131 void readTemp();
orlagilson 5:3246c4b8362c 132
orlagilson 5:3246c4b8362c 133 /** Read Pressure;
orlagilson 5:3246c4b8362c 134 * calls callPress after 0.1 seconds;
orlagilson 5:3246c4b8362c 135 * reads pressure every 30 minutes/1800 seconds;
orlagilson 5:3246c4b8362c 136 * prints pressure to screen;
orlagilson 5:3246c4b8362c 137 * updates screen every 30 minutes with new pressure
orlagilson 5:3246c4b8362c 138 */
orlagilson 5:3246c4b8362c 139 void readPress();
orlagilson 5:3246c4b8362c 140
orlagilson 5:3246c4b8362c 141 /** Measurement;
orlagilson 5:3246c4b8362c 142 * read measurement from sensor;
orlagilson 5:3246c4b8362c 143 * set temperature;
orlagilson 5:3246c4b8362c 144 * set pressure
orlagilson 5:3246c4b8362c 145 */
orlagilson 5:3246c4b8362c 146 void measurement();
orlagilson 5:3246c4b8362c 147
orlagilson 5:3246c4b8362c 148 /** Temperature Graph;
orlagilson 5:3246c4b8362c 149 * read temperature every 2 seconds;
orlagilson 5:3246c4b8362c 150 * create temporary array;
orlagilson 5:3246c4b8362c 151 * read temperature values into array;
orlagilson 5:3246c4b8362c 152 * scale temperature array;
orlagilson 5:3246c4b8362c 153 * plot array
orlagilson 5:3246c4b8362c 154 */
orlagilson 5:3246c4b8362c 155 void tempGraph();
orlagilson 5:3246c4b8362c 156
orlagilson 5:3246c4b8362c 157 /** Pressure Graph;
orlagilson 5:3246c4b8362c 158 * read pressure every 2 seconds;
orlagilson 5:3246c4b8362c 159 * create temporary array;
orlagilson 5:3246c4b8362c 160 * read pressure values into array;
orlagilson 5:3246c4b8362c 161 * scale pressure array;
orlagilson 5:3246c4b8362c 162 * plot array
orlagilson 5:3246c4b8362c 163 */
orlagilson 5:3246c4b8362c 164 void pressGraph();
orlagilson 5:3246c4b8362c 165
orlagilson 5:3246c4b8362c 166 /** Menu;
orlagilson 5:3246c4b8362c 167 * print temperature screen if potentiometer is greater than 2/3;
orlagilson 5:3246c4b8362c 168 * print pressure screen if potentiometer is between 1/3 and 2/3;
orlagilson 5:3246c4b8362c 169 * print light screen if potentiometer is less than 1/3;
orlagilson 5:3246c4b8362c 170 */
orlagilson 5:3246c4b8362c 171 void menu();
orlagilson 5:3246c4b8362c 172
orlagilson 5:3246c4b8362c 173 /** Clear Cells;
orlagilson 5:3246c4b8362c 174 * cycle through pixels and set to zero
orlagilson 5:3246c4b8362c 175 */
orlagilson 5:3246c4b8362c 176 void clearCells();