personal changes

Dependents:   Smart_Car_Seat_v1

Fork of FSR by Chenkai Shao

Files at this revision

API Documentation at this revision

Comitter:
jd0205
Date:
Wed May 03 21:01:09 2017 +0000
Parent:
5:d9520bf7eb9e
Commit message:
Just personal changes

Changed in this revision

FSR.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FSR.cpp	Thu Oct 22 17:06:17 2015 +0000
+++ b/FSR.cpp	Wed May 03 21:01:09 2017 +0000
@@ -14,13 +14,13 @@
 float FSR::readFSRResistance()
 {
     float read = _ain;
-    return _r * 1 / read - _r;
+    return _r * (1 - read) / read;
 }
 
 float FSR::readWeight()
 {
     float read = _ain;
-    float rfsr = _r * 1 / read - _r;
+    float rfsr = _r * (1 - read) / read;
     float slope = (4 - 2) / (log10(6.2) - log10(0.25));
     float a = log10(rfsr);
     if (a < log10(6.2))