Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Classes and objects inside them that can be used my all members of a class on: April 01, 2013, 08:42:17 pm
Hello all,

I made a library and I am trying to call a pre-existing library. The PID_1v library is the one being called from inside my library. I would just post my code as it would show the problem better, but its for a engineering competition and I am not supposed to post the code and stuff like that. How does one go about using something like the PID library, construct it, and make it usable to all of my class?

Code:
#include "myLib.h"

myLib lib;
void setup(){

}

void loop(){
    lib.myLibUpdate();
}


Code:
#ifndef MYLIB_H
#define MYLIB_H

class
{
   private:
             int myVar;
   public:
             myLib();
             myLibUpdate();
};
#endif

Code:
#include "myLib.h"
#include "PID.h"

myLib::myLib()
{
   PID myPID(input,output,value,kp,ki,kd,DIRECT); // This is what I am trying and its not working
}


myLib::myLibUpdate()
{
   myPID.compute();
}

Pages: [1]