Očitavanje temperature pomoću LM35 senzora.
Fork of LM35 by
Revision 0:0604431a65be, committed 2021-02-22
- Comitter:
- lbuha
- Date:
- Mon Feb 22 01:53:52 2021 +0000
- Commit message:
- .
Changed in this revision
LM35.cpp | Show annotated file Show diff for this revision Revisions of this file |
LM35.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM35.cpp Mon Feb 22 01:53:52 2021 +0000 @@ -0,0 +1,19 @@ +#include "LM35.h" +#include "mbed.h" + +LM35::LM35(PinName pin) : _pin(pin) {} + +float temperatura; + +float LM35::mjerenje() +{ + + Serial pc(USBTX, USBRX); + temperatura = _pin.read(); + temperatura = (temperatura)*500; + + pc.printf("Temperatura je %f stupnjeva Celzijevih.\n \n \r", temperatura); //ispis temperature na računalo + + return temperatura; + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM35.h Mon Feb 22 01:53:52 2021 +0000 @@ -0,0 +1,15 @@ +#ifndef MBED_LM35 +#define MBED_LM35 +#include "mbed.h" +class LM35 +{ +public: + LM35(PinName pin); + float mjerenje(); + +private: + AnalogIn _pin; + +}; + +#endif \ No newline at end of file