megan gimple / PVD_Driver

Files at this revision

API Documentation at this revision

Comitter:
mgimple
Date:
Sat Nov 13 20:10:19 2021 +0000
Parent:
1:460124e3da18
Commit message:
PVD+voltage

Changed in this revision

PVD_Driver.cpp Show annotated file Show diff for this revision Revisions of this file
PVD_Driver.h Show annotated file Show diff for this revision Revisions of this file
--- a/PVD_Driver.cpp	Thu Nov 11 23:03:49 2021 +0000
+++ b/PVD_Driver.cpp	Sat Nov 13 20:10:19 2021 +0000
@@ -2,8 +2,8 @@
 
 PVD::PVD(PinName in1): _in1(in1)
 {
-        R=10000;
-        V=3.3;
+    R=10000;
+    V=3.3;
 }
 
 float PVD::Res()
@@ -12,3 +12,8 @@
     float res=((R/volt)-V)/1000;
     return res;
 }
+float PVD::Volt()
+{
+    float volt=_in1.read()*3.3;
+    return volt;
+}
\ No newline at end of file
--- a/PVD_Driver.h	Thu Nov 11 23:03:49 2021 +0000
+++ b/PVD_Driver.h	Sat Nov 13 20:10:19 2021 +0000
@@ -10,6 +10,7 @@
     PVD(PinName in1);
     float R,V;
     float Res();
+    float Volt();
 
 private:
     AnalogIn _in1;