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:
- 6:1b5603fd1a9c
- Parent:
- 5:3246c4b8362c
--- a/main.h Thu May 07 16:11:21 2015 +0000
+++ b/main.h Mon May 11 14:25:05 2015 +0000
@@ -9,6 +9,10 @@
#ifndef MAIN_H
#define MAIN_H
#include "mbed.h"
+#include "BMP180.h"
+#include "N5110.h"
+#include "PowerControl/PowerControl.h"
+#include "PowerControl/EthernetPowerControl.h"
/**
@namespace lcd
@@ -23,6 +27,18 @@
BMP180 bmp180(p28,p27);
/**
+@namespace local
+@brief creates local file system to write files to
+*/
+LocalFileSystem local("local");
+
+/**
+@namespace leds
+@brief bus output for the two centre on-board leds
+*/
+BusOut leds(LED3,LED2);
+
+/**
@namespace buttonleft
@brief interrupt in function for the left hand button
*/
@@ -47,6 +63,18 @@
DigitalOut led(p25);
/**
+@namespace buzzer
+@brief PWM output for piezo buzzer
+*/
+PwmOut buzzer(p21);
+
+/**
+@namespace LDR
+@brief analog input for the light dependant resistor
+*/
+AnalogIn LDR(p17);
+
+/**
Sets x axis of screen
@param nx - length of x axis
*/
@@ -65,19 +93,80 @@
*/
int i,j;
+/**
+* initialising a decimal variable
+*/
+float temperature;
-float temperature;
+/**
+* initialising a decimal variable
+*/
float pressure;
+
+/**
+* initialise the counter as an integer
+*/
+int counter=0;
+
+/**
+* initialise the flag for the button
+*/
int buttonFlag=0;
+
+/**
+* timeout used for temperature
+*/
Timeout callT;
+
+/**
+* timeout used for pressure
+*/
Timeout callP;
+
+/**
+* timeout used for light
+*/
+Timeout callL;
+
+/**
+* ticker function for temperature
+*/
Ticker timerT;
+
+/**
+* ticker function for pressure
+*/
Ticker timerP;
+
+/**
+* ticker function for error
+*/
Ticker timerE;
+
+/**
+* ticker function for light
+*/
+Ticker timerL;
+
+/**
+* initialise flag for temperature
+*/
int timerTFlag = 0;
+
+/**
+* initialise flag for pressure
+*/
int timerPFlag = 0;
+
+/**
+* initialise flag for error
+*/
int timerEFlag = 0;
+/**
+* initialise flag for light
+*/
+int timerLFlag = 0;
/** Expire Timer T;
* timer associated with temperature;
@@ -97,6 +186,12 @@
*/
void timerEExpired();
+/** Expire Timer L;
+* timer associated with error LED;
+* sets timerLFlag to one
+*/
+void timerLEpired();
+
/** Press Button;
* interrupt associated with left button;
* sets buttonFlag to one
@@ -110,6 +205,11 @@
*/
void error();
+/** Write Data To File;
+* function to write data to the flash drive
+*/
+void writeDataToFile();
+
/** Calls Temperature;
* function reads the temperature from the sensor;
* prints the current temperature to the screen
@@ -122,6 +222,12 @@
*/
void callPress();
+/** Calls Light;
+* function reads the light from the LDR;
+* prints the current temperature to the screen
+*/
+void callLight();
+
/** Read Temperature;
* calls callTemp after 0.1 seconds;
* reads temperature every 60 seconds;
@@ -138,6 +244,14 @@
*/
void readPress();
+/** Read Light;
+* calls callLight after 0.1 seconds;
+* reads light every 60 seconds;
+* prints light to screen;
+* updates screen every 60 seconds with new light
+*/
+void readLight();
+
/** Measurement;
* read measurement from sensor;
* set temperature;
@@ -163,10 +277,19 @@
*/
void pressGraph();
+/** Light Graph;
+* read light every 2 seconds;
+* create temporary array;
+* read light values into array;
+* scale light array;
+* plot array
+*/
+void lightGraph();
+
/** 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;
+* print light screen if potentiometer is less than 1/3
*/
void menu();
@@ -174,3 +297,5 @@
* cycle through pixels and set to zero
*/
void clearCells();
+
+#endif
\ No newline at end of file