Majid Pakdel / PXMathLibrary

Dependents:   PXMathLibrary_Example

Files at this revision

API Documentation at this revision

Comitter:
mpakdel
Date:
Sun Jun 14 06:41:04 2020 +0000
Commit message:
Majid Pakdel Math Library

Changed in this revision

PXMathLibrary.cpp Show annotated file Show diff for this revision Revisions of this file
PXMathLibrary.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PXMathLibrary.cpp	Sun Jun 14 06:41:04 2020 +0000
@@ -0,0 +1,14 @@
+#include "mbed.h"
+#include "PXMathLibrary.h"
+
+PXMathLibrary::PXMathLibrary(PinName pin1, PinName pin2):_pin1(pin1), _pin2(pin2) {
+    
+}
+
+void PXMathLibrary::mean() {
+    float x = _pin1.read();
+    float y = _pin2.read();
+    float z = (x+y)/2.0f;
+    printf("%10.3f \t %10.3f \t %10.3f \n\r", x, y, z);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PXMathLibrary.h	Sun Jun 14 06:41:04 2020 +0000
@@ -0,0 +1,17 @@
+#ifndef MBED_PXMATHLIBRARY_H
+#define MBED_PXMATHLIBRARY_H
+
+#include "mbed.h"
+
+class PXMathLibrary {
+public:
+  PXMathLibrary(PinName pin1, PinName pin2);
+  void mean();
+  
+private: 
+  AnalogIn _pin1;
+  AnalogIn _pin2;
+  
+};
+
+#endif
\ No newline at end of file