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.
Diff: main.cpp
- Revision:
- 2:b990d41df49e
- Parent:
- 1:2a3b76b2e4e5
- Child:
- 3:6076b262dc5e
--- a/main.cpp Sat Jul 10 17:44:52 2021 +0000 +++ b/main.cpp Sun Jul 11 06:59:01 2021 +0000 @@ -4,7 +4,7 @@ 2)AMOUR SALIM MOHAMMED REG NBER: 221027397 3)SHAAME M. BAKAR REG NBER: 220020578 4)ANGELIQUE*/ - + #include "mbed.h" #include "C12832.h" #include "Sht31.h" @@ -34,7 +34,7 @@ int pushDuration; int current=0; int state=0; - + string str1 = "Menu of the Day"; string str2 = "Rwanda Food Services Ltd"; string str3="Rwanda Food Services Ltd,click Btn to browseMenu"; @@ -53,11 +53,11 @@ lcd.locate(0,0); lcd.printf(sms.c_str()); } - + void welcomeMsg(){ display(str2); } - + void displayState1(){ float temp = theo.readTemperature(); time_t seconds = time(NULL); @@ -71,7 +71,7 @@ lcd.locate(5, 9); lcd.printf("Temperature: %.2f C", temp); } - + void whiteled() { @@ -94,6 +94,7 @@ } } void displayState2(){ + printf("direction %d \n",direction); if(direction==0){ i=0; bed=1; @@ -107,10 +108,11 @@ topicTicker.attach(callback(& backwards),2.0f); } } - + void fallBtn(){ state = 0; - + durationTime.detach(); + } void mode1(){ k.attach(callback(& whiteled),1.0f); @@ -139,6 +141,7 @@ void countDuration(){ time(&stopTime); pushDuration=stopTime-startTime; + printf("elapsed time is:%d \n",pushDuration); if(pushDuration>5){ display("System resetting......\n"); durationTime.detach(); @@ -148,8 +151,9 @@ backagain.attach(callback(&mode1),15.0f); } - else if(pushDuration>3 && state==0 ){ - state =0; + else if(pushDuration>=3 && state==0 ){ + state =1; + printf("direction changed %d \n",direction); direction=!direction; displayState2(); @@ -158,9 +162,9 @@ void riseBtn(){ time(&startTime); durationTime.attach(callback(&countDuration),0.5f); - + } - + int main() { welcomeMsg(); t.attach(callback(&mode1),5.0f); @@ -168,4 +172,4 @@ btn.fall(callback(&fallBtn)); swt.rise(callback(&riseSwt)); swt.fall(callback(&fallSwt)); -} +} \ No newline at end of file