Basic example for PID library

Dependencies:   PID mbed

Revision:
0:8454aaf72e4c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Aug 14 23:25:00 2018 +0000
@@ -0,0 +1,35 @@
+ #include    "mbed.h"
+ #include    "PID.h"
+
+Serial pc(USBTX,USBRX);
+
+//Define Variables we'll be connecting to
+double Input;
+double Output;
+double Setpoint;
+
+PwmOut pinOut(D0);
+DigitalIn a(D1);
+//Specify the links and initial tuning parameters
+double Kp=1, Ki=1, Kd=1;
+PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, P_ON_M, DIRECT);
+
+int main()
+{
+  //initialize the variables we're linked to
+    pinOut.period(.001f);
+
+    Input = a.read();
+  Setpoint = 90;
+  
+  myPID.SetMode(AUTOMATIC);
+
+  while(1)
+  {
+    Input = a.read();
+    myPID.Compute();
+    pinOut = Output;
+    wait(.1);
+  }
+}
+