2 Replies Latest reply on Sep 29, 2014 4:20 PM by DustNnotes

    PID Controller library working on Galileo?

    DustNnotes

      Has anyone had luck getting the PID_v1 library working on Galileo?

       

      As best I can tell, the Galileo system hangs when I invoke the first PID instance.  Below is a slightly modified version of the basic PID example (Arduino Playground - PIDLibaryBasicExample) from the Arduino Learning site, with a print statement inserted to provide signs of life.  I downloaded the PID_v1 library using the Github link from the same site.

       

      Any advice?

       

      /********************************************************

      * PID Basic Example

      * Reading analog input 0 to control analog PWM output 3

      ********************************************************/

       

       

      #include <PID_v1.h>

       

       

      //Define Variables we'll be connecting to

      double Setpoint, Input, Output;

       

       

      //Specify the links and initial tuning parameters

      PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);

       

       

      void setup()

      {

        //initialize the variables we're linked to

        Input = analogRead(0);

        Setpoint = 100;

       

       

        //turn the PID on

        myPID.SetMode(AUTOMATIC);

       

        // initialize the serial communication:

        Serial.begin(9600);

      }

       

       

      void loop()

      {

        Input = analogRead(0);

        myPID.Compute();

        analogWrite(3,Output);

        Serial.println("Sketch running.");

      }