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:
- 5:265e04e0cc1d
- Parent:
- 4:657329790c52
- Child:
- 6:4b366905136f
--- a/main.cpp Fri Oct 16 01:57:25 2020 +0000 +++ b/main.cpp Fri Oct 16 16:14:05 2020 +0000 @@ -8,7 +8,7 @@ DigitalIn switch_input(p17); float T; //temp float V; //voltage -float m; //varibale in equation defined +float m; //variable in equation defined float a; float i; float n; @@ -20,37 +20,41 @@ i=3.88e-6; n=2.1962e6; -V=aI.read_u16(); +V=aI.read(); T=(m+(sqrt(n+(a-V)/(i)))); //Temp equation pc.printf("V=%f\r\n", V ); while(1) { if (25>=T>20) { - led1=1; + led1=1; //on pc.printf("T=%f\r\n", T ); } else if (30>=T>25) { - led2=1; + led2=1; //on led1=0; pc.printf("T=%f\r\n", T ); } - else (T>30) { - led3=1; + else if(T>30) { + led3=1; //on led2=0; led1=0; - pc.printf("T=%d\r\n", T ); } + pc.printf("T=%f\r\n", T ); } }} int second() { +//NOT SURE IF THIS IS CORRECT from here down, but it seems to compile. +//any help would be appreciated + while(1) { if (switch_input==1) { pc.printf("%d\r\n", switch_input.read()); wait(1); //1 Hz } - else if (wait(4)) { //.25 Hz + else if (switch_input==.25) { //.25 Hz + wait(4); pc.printf("%d\r\n", switch_input.read()); } - else (switch_input==0) { + else if(switch_input==0) { pc.printf("%d\r\n", switch_input.read()); - wait(0) }} //off + wait(0); }} //off } \ No newline at end of file