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: BMP280
Revision 18:dff5292d62a9, committed 2018-01-08
- Comitter:
- Swaggie
- Date:
- Mon Jan 08 00:51:09 2018 +0000
- Parent:
- 17:95b0b1ec0f90
- Commit message:
- A working class structure with two buttons.
Changed in this revision
--- a/LCD.cpp Sun Jan 07 00:06:48 2018 +0000
+++ b/LCD.cpp Mon Jan 08 00:51:09 2018 +0000
@@ -2,6 +2,7 @@
#include "LCD.h"
#include "TextLCD.h"
#include "rtos.h"
+#include "Sampling.h"
EnviromLCDDisplay::EnviromLCDDisplay(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, PinName Button1Pin, PinName Button2) : TextLCD(rs, e, d4, d5, d7, d7), _LCDThread(), _Button2(Button2)
{
@@ -17,7 +18,7 @@
bool EnviromLCDDisplay::POST(void)
{
- printf("Push Button 1"); //Print to LCD
+ this->printf("Push Button 1"); //Print to LCD
while (!_Button2) {} //Wait until button is pushed
return true; //The test has passed
}
@@ -40,13 +41,15 @@
while (1)
{
//Setup button 1 as Interrupt In
+ InterruptIn* TimeAdjustButton = new InterruptIn(_Button1Pin);
+ //TimeAdjustButton
switch (_TState) {
case MESSAGE :
//display a message on the screen
cls(); //Clear the screen
printf("%s", _message); //Put the message on the screen
- Thread::wait(3000); //Wait 3 secs before doing anything else
+ Thread::wait(SCREENDELAY_MS); //Wait before doing anything else
if (_AutoQuit && (_TState == MESSAGE)) //Therefore button 1 interrupt won't be overwritten
{
_TState = SCROLLREADINGS; //Return to showing data
@@ -55,18 +58,20 @@
case SCROLLREADINGS :
//Show enviromental readings
cls();
- printf("Pres: xxxx.xmBar\n");
- printf("Temp: xx.x C");
- Thread::wait(2000); //Screen hold
+ printf("Pres: %f4.2mBar\n", presReadings[currentIndex]);
+ printf("Temp: %f2.1 C", tempReadings[currentIndex]);
+ Thread::wait(SCREENDELAY_MS); //Screen hold
cls();
- printf("LDR: xx.x, Taken");
+ printf("LDR: %f2.1, Taken", LDRReadings[currentIndex]);
printf("HH:mm, DD/MM");
- Thread::wait(2000);
+ Thread::wait(SCREENDELAY_MS);
break;
case ADJUSTTIME :
//Adjust time with userbuttons
//delete button 1 as interupt in.
-
+ cls();
+ printf("Adjust Time:");
+ printf("HH:MM DD/MM/YY !");
//create button 1 as digital in.
break;
--- a/LCD.h Sun Jan 07 00:06:48 2018 +0000
+++ b/LCD.h Mon Jan 08 00:51:09 2018 +0000
@@ -11,7 +11,9 @@
#include <string>
//These functions manage writing to the LCD
-class EnviromLCDDisplay : private TextLCD
+#define SCREENDELAY_MS 20000
+
+class EnviromLCDDisplay : public TextLCD
{
private:
//private variables
--- a/main.cpp Sun Jan 07 00:06:48 2018 +0000
+++ b/main.cpp Mon Jan 08 00:51:09 2018 +0000
@@ -26,10 +26,12 @@
//Hardware Self Test
+ lcd.printf("What up?\n");
//Initialise interrupts and times
ConfigThreadsAndIR();
firstSample = true; //Set only at start of program
+ //bool Test = lcd.POST();
//Run
while (true)