PID Feedback Control

Dependencies:   mbed PID

Revision:
0:7e0c2b0edbc8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AnalogOut.cpp	Tue Nov 19 20:46:36 2019 +0000
@@ -0,0 +1,40 @@
+
+
+/*
+int main() {
+AnalogOut Aout(p18);
+PwmOut Pout(p26);
+ while(1) {
+ //Aout=1.3; // 0.5*3.3V = 1.65V
+ Pout=1.0;
+ wait(1);
+ }
+}
+
+
+#include "mbed.h"
+#include "time.h"
+
+LocalFileSystem local("local");               // Create the local filesystem under the name "local"
+AnalogIn in(p15);
+AnalogOut out(p18);
+DigitalOut led(LED1);
+Timer t;
+     
+
+int main() {
+    FILE *fp = fopen("/local/amp.txt", "w");  // Open "out.txt" on the local file system for writing
+    t.start();
+    out = 0;
+        for (int i = 0; i<1000; i++){
+          fprintf(fp, "%f\t%f\n", t.read(), out.read()*3.3);
+            led = 1;
+            if(i == 500){
+                out = 1.5/3.3;
+                }
+            }   
+        fclose(fp);
+        led = 0;
+}
+
+*/