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:
- 4:657329790c52
- Parent:
- 3:b755f0cf35bc
- Child:
- 5:265e04e0cc1d
diff -r b755f0cf35bc -r 657329790c52 main.cpp
--- a/main.cpp Fri Oct 16 01:41:49 2020 +0000
+++ b/main.cpp Fri Oct 16 01:57:25 2020 +0000
@@ -6,23 +6,32 @@
DigitalOut led3(LED3);
AnalogIn aI(p19);
DigitalIn switch_input(p17);
-float T;
-float V;
+float T; //temp
+float V; //voltage
+float m; //varibale in equation defined
+float a;
+float i;
+float n;
int main() {
+ V=(3.3); //Vref
+ m=-1481.96;
+ a=1.8639;
+ i=3.88e-6;
+ n=2.1962e6;
V=aI.read_u16();
-T = -1481.96+ sqrt((2.1962e6)+((1.8639-V)/3.88e-6)));
+T=(m+(sqrt(n+(a-V)/(i)))); //Temp equation
pc.printf("V=%f\r\n", V );
while(1) {
if (25>=T>20) {
led1=1;
- pc.printf("T=%d\r\n", T ); }
+ pc.printf("T=%f\r\n", T ); }
else if (30>=T>25) {
led2=1;
led1=0;
- pc.printf("T=%d\r\n", T ); }
+ pc.printf("T=%f\r\n", T ); }
else (T>30) {
led3=1;
led2=0;