Class Analog Sensor for ASAD.
Sensor.cpp
- Committer:
- renemagrit
- Date:
- 2019-09-09
- Revision:
- 0:ec0a410e0ce6
File content as of revision 0:ec0a410e0ce6:
#include <Sensor.h> Sensor::Sensor():n(0),k(0){ pin=A0; } Sensor::Sensor(PinName _pin,float _n,float _k):n(_n),k(_k){ //Iz nekog razoga se buni ako je u inicijalizatorskoj listi pa //MORA da se napise u telu konstruktora da bi radio pin=_pin; } float Sensor::value(){ AnalogIn ain(pin); return ain.read()*k+n; }