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:e6e11d6db1dc
- Parent:
- 1:b8b505e84b78
- Child:
- 3:b755f0cf35bc
--- a/main.cpp Thu Oct 15 02:33:43 2020 +0000 +++ b/main.cpp Fri Oct 16 00:18:15 2020 +0000 @@ -5,23 +5,37 @@ DigitalOut led2(LED2); DigitalOut led3(LED3); AnalogIn aI(p19); +DigitalIn switch_input(p17); float T; -int V; +float V; int main() { -int V = (-3.88*10^(-6)*T^2)+(-1.15*10^(-2)*T)+1.8639; -aI.read_u16()="V"; -pc.printf("V=%d\r\n", V ); +V=aI.read_u16(); +T = -1481.96+ sqrt((2.1962e6)+((1.8639-V)/3.88e-6))); +pc.printf("V=%f\r\n", V ); while(1) { if (25>=T>20) { led1=!led1; - pc.printf("T=%f\r\n", T ); } + pc.printf("T=%d\r\n", T ); } else if (30>=T>25) { led2=!led2; - pc.printf("T=%f\r\n", T ); } + pc.printf("T=%d\r\n", T ); } else (T>30) { led3=!led3; - pc.printf("T=%f\r\n", T ); } -} -} \ No newline at end of file + pc.printf("T=%d\r\n", T ); } +}} +int second() { +while(1) { + if (switch_input==1) { + pc.printf("%d\r\n", switch_input.read()); + wait(1); //1 Hz + } + else if (wait(4)) { //.25 Hz + pc.printf("%d\r\n", switch_input.read()); + } + else (switch_input==0) { + pc.printf("%d\r\n", switch_input.read()); + wait(0) }} + } + \ No newline at end of file