a library to read sonar values with the MaxbotixLV sonar range sensors..
MaxbotixLV.cpp
- Committer:
- kaushalpkk
- Date:
- 2011-07-15
- Revision:
- 0:b99b1e0e3290
File content as of revision 0:b99b1e0e3290:
#include "mbed.h"
#include "MaxbotixLV.h"
MaxbotixLV::MaxbotixLV(PinName analogIN):
_analogIn(analogIN) {
_voltIn = 3.300;
_scaler = 0.0098;
}
void MaxbotixLV::setVoltage(float voltIn) {
_voltIn = (voltIn);
}
void MaxbotixLV::setScale(float scaler) {
_scaler = (scaler);
}
float MaxbotixLV::getInches() {
float reading = _analogIn.read();
float Avolts = reading * _voltIn;
return (Avolts / _scaler);
}
float MaxbotixLV::getAnalog() {
return _analogIn.read();
}