Krishna Kaushal Panduru / Mbed 2 deprecated myMaxbotixLV

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kaushalpkk
Date:
Thu Jul 14 23:44:15 2011 +0000
Commit message:
Initial release works on the analog outputs from the sensor..
i2c and PWM will be added soon.

Changed in this revision

MaxbotixLV.cpp Show annotated file Show diff for this revision Revisions of this file
MaxbotixLV.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaxbotixLV.cpp	Thu Jul 14 23:44:15 2011 +0000
@@ -0,0 +1,29 @@
+#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();
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaxbotixLV.h	Thu Jul 14 23:44:15 2011 +0000
@@ -0,0 +1,20 @@
+#ifndef MBED_MAXBOT_H
+#define MBED_MAXBOT_H
+
+#include "mbed.h"
+
+class MaxbotixLV{
+public:
+    MaxbotixLV(PinName analogIN);
+    void setVoltage(float voltIn);
+    void setScale(float scaler);
+    float getAnalog();
+    float getInches();
+    
+protected:
+    AnalogIn _analogIn;
+    float _voltIn;
+    float _scaler;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 14 23:44:15 2011 +0000
@@ -0,0 +1,8 @@
+#include "mbed.h"
+#include "MaxbotixLV.h"
+    
+int main() {
+    
+    while(1) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jul 14 23:44:15 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912