Library to read rawdata from an FSR

Dependents:   K64F-RTOS-MQTT-Example

Fork of FSR by Chenkai Shao

Files at this revision

API Documentation at this revision

Comitter:
ram54288
Date:
Tue May 02 16:48:41 2017 +0000
Parent:
5:d9520bf7eb9e
Commit message:
Changed the return types to *ptr

Changed in this revision

FSR.cpp Show annotated file Show diff for this revision Revisions of this file
FSR.h Show annotated file Show diff for this revision Revisions of this file
diff -r d9520bf7eb9e -r bf85a85d7808 FSR.cpp
--- a/FSR.cpp	Thu Oct 22 17:06:17 2015 +0000
+++ b/FSR.cpp	Tue May 02 16:48:41 2017 +0000
@@ -11,10 +11,14 @@
     return read;
 }
 
-float FSR::readFSRResistance()
+float* FSR::readFSRResistance()
 {
     float read = _ain;
-    return _r * 1 / read - _r;
+    //float* obj=new float;
+    //obj=(_r * 1 / read - _r);
+    //return obj;
+    float t=(_r * 1 / read - _r);
+    return &t;
 }
 
 float FSR::readWeight()
diff -r d9520bf7eb9e -r bf85a85d7808 FSR.h
--- a/FSR.h	Thu Oct 22 17:06:17 2015 +0000
+++ b/FSR.h	Tue May 02 16:48:41 2017 +0000
@@ -42,7 +42,7 @@
      *
      * @return the resistance of the FSR
      */
-    float readFSRResistance();   
+    float* readFSRResistance();   
     
     /** Read the weight in N. 0 anyway if the weight is less than 100g
      *