Calculating sets of parameters of cubic polynomials for cubic spline interpolation

Dependencies:   mbed CubicSpline

Files at this revision

API Documentation at this revision

Comitter:
aktk
Date:
Wed Oct 21 17:27:16 2020 +0000
Commit message:
first commit;

Changed in this revision

CubicSpline.lib 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/CubicSpline.lib	Wed Oct 21 17:27:16 2020 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/aktk/code/CubicSpline/#9a51747773af
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 21 17:27:16 2020 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "CubicSpline.h"
+DigitalOut myled(LED1);
+CubicSpline2d sensor(5,AsDEBUG);
+extern Serial g_Serial_Signal;
+extern AnalogIn g_Sensor_Voltage;
+
+int main()
+{
+    double x,y;
+    Timer t;
+    myled = 1;
+    printf("c or l>");
+    if(g_Serial_Signal.getc() == 'c') {
+        sensor.calibrateSensor();
+        sensor.printOutData();
+        sensor.saveSetting();
+    } else {
+        sensor.loadSetting();
+        printf("press any key");
+        g_Serial_Signal.getc();
+        sensor.printOutData();
+    }
+    myled = 0;
+
+    while(1) {
+        myled = 1;
+        if(g_Serial_Signal.readable()) {
+            g_Serial_Signal.getc();
+            y = g_Sensor_Voltage.read();
+            t.start();
+            x = sensor.getX(y);
+            t.stop();
+            printf("y: %f -> x: %f (time: %f)\n",y, x , t.read());
+            t.reset();
+            myled = 0;
+            wait(0.2);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 21 17:27:16 2020 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7c328cabac7e
\ No newline at end of file