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.
Revision 1:6249f99332e0, committed 2021-11-12
- Comitter:
- mackenziefraser
- Date:
- Fri Nov 12 01:56:04 2021 +0000
- Parent:
- 0:876059873ad6
- Commit message:
- added comments
Changed in this revision
LM19_Driver.cpp | Show annotated file Show diff for this revision Revisions of this file |
LM19_Driver.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 876059873ad6 -r 6249f99332e0 LM19_Driver.cpp --- a/LM19_Driver.cpp Wed Nov 10 15:13:35 2021 +0000 +++ b/LM19_Driver.cpp Fri Nov 12 01:56:04 2021 +0000 @@ -1,7 +1,11 @@ +//Mackenzie Fraser +//Assignment 4.1 +//Initialization function/inputs file + #include "LM19_Driver.h" -LM19::LM19(PinName in1): _in1(in1) { - c1 = -1481.96; +LM19::LM19(PinName in1): _in1(in1) { + c1 = -1481.96; //set coefficient values c2 = 2.1962*1000000.000; c3 = 1.8636; c4 = 3.88/1000000.000; @@ -9,6 +13,11 @@ float LM19::temp(){ float volt=_in1.read()*3.3; - float T=c1+sqrt(c2 + (c3-volt)/c4); + float T=c1+sqrt(c2 + (c3-volt)/c4); //temperature computing function return T; +} + +float LM19::voltage(){ + float V=_in1.read()*3.3; + return V; } \ No newline at end of file
diff -r 876059873ad6 -r 6249f99332e0 LM19_Driver.h --- a/LM19_Driver.h Wed Nov 10 15:13:35 2021 +0000 +++ b/LM19_Driver.h Fri Nov 12 01:56:04 2021 +0000 @@ -1,3 +1,7 @@ +//Mackenzie Fraser +//Assignment 4.1 +//Header file: define inputs + #ifndef LM19_Driver_H #define LM19_Driver_H @@ -9,6 +13,7 @@ LM19(PinName in1); //initialization function float c1, c2, c3, c4; float temp(); //temperature computation + float voltage(); private: AnalogIn _in1;