Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BMP180 N5110 mbed
Diff: main.h
- Revision:
- 5:3246c4b8362c
- Child:
- 6:1b5603fd1a9c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Thu May 07 16:11:21 2015 +0000 @@ -0,0 +1,176 @@ +/** +@file main.h +@brief header file containing functions and variables +@brief Revision 1.0 +@author Orla Gilson +@date May 2015 +*/ + +#ifndef MAIN_H +#define MAIN_H +#include "mbed.h" + +/** +@namespace lcd +@brief bus output for Nokia 5110 LCD screen +*/ +N5110 lcd(p7,p8,p9,p10,p11,p13,p26); + +/** +@namespace bmp180 +@brief serial input for BMP180 sensor +*/ +BMP180 bmp180(p28,p27); + +/** +@namespace buttonleft +@brief interrupt in function for the left hand button +*/ +InterruptIn buttonleft(p15); + +/** +@namespace BUT2 +@brief analog in function for the right hand button +*/ +AnalogIn BUT2(p16); + +/** +@namespace POT +@brief analog in function for the potentiometer +*/ +AnalogIn POT(p20); + +/** +@namespace led +@brief GPIO output for error LED +*/ +DigitalOut led(p25); + +/** +Sets x axis of screen +@param nx - length of x axis +*/ +int nx=84; + +/** +Sets y axis of screen +@param ny - length of y axis +*/ +int ny=48; + +/** +Coordinates of a pixel +@param i - x value of coordinate (0-83) +@param j - y value of coordinate (0-47 +*/ +int i,j; + + +float temperature; +float pressure; +int buttonFlag=0; +Timeout callT; +Timeout callP; +Ticker timerT; +Ticker timerP; +Ticker timerE; +int timerTFlag = 0; +int timerPFlag = 0; +int timerEFlag = 0; + + +/** Expire Timer T; +* timer associated with temperature; +* sets timerTFlag to one +*/ +void timerTExpired(); + +/** Expire Timer P; +* timer associated with pressure; +* sets timerPFlag to one +*/ +void timerPExpired(); + +/** Expire Timer E; +* timer associated with error LED; +* sets timerEFlag to one +*/ +void timerEExpired(); + +/** Press Button; +* interrupt associated with left button; +* sets buttonFlag to one +*/ +void buttonPressed(); + +/** Error Function; +* function supplies error function; +* LED lights up every 2 seconds; +* buzzer goes off simultaneously with the LED +*/ +void error(); + +/** Calls Temperature; +* function reads the temperature from the sensor; +* prints the current temperature to the screen +*/ +void callTemp(); + +/** Calls Pressure; +* function reads the pressure from the sensor; +* prints the current pressure to the screen +*/ +void callPress(); + +/** Read Temperature; +* calls callTemp after 0.1 seconds; +* reads temperature every 60 seconds; +* prints temperature to screen; +* updates screen every 60 seconds with new temperature +*/ +void readTemp(); + +/** Read Pressure; +* calls callPress after 0.1 seconds; +* reads pressure every 30 minutes/1800 seconds; +* prints pressure to screen; +* updates screen every 30 minutes with new pressure +*/ +void readPress(); + +/** Measurement; +* read measurement from sensor; +* set temperature; +* set pressure +*/ +void measurement(); + +/** Temperature Graph; +* read temperature every 2 seconds; +* create temporary array; +* read temperature values into array; +* scale temperature array; +* plot array +*/ +void tempGraph(); + +/** Pressure Graph; +* read pressure every 2 seconds; +* create temporary array; +* read pressure values into array; +* scale pressure array; +* plot array +*/ +void pressGraph(); + +/** Menu; +* print temperature screen if potentiometer is greater than 2/3; +* print pressure screen if potentiometer is between 1/3 and 2/3; +* print light screen if potentiometer is less than 1/3; +*/ +void menu(); + +/** Clear Cells; +* cycle through pixels and set to zero +*/ +void clearCells();