moved library code back to root from sub-folder
when github was adding a hash to the library download zip, there was confusion from beginners about needing to rename the unzipped folder before moving into the arduino ide. this library has been prepped (thijse) for the arduino library manager, which requires the library to be in the root directory. Having the library in the manager also removes the "beginner user hash" concern.
This commit is contained in:
31
examples/PID_Basic/PID_Basic.ino
Normal file
31
examples/PID_Basic/PID_Basic.ino
Normal file
@ -0,0 +1,31 @@
|
||||
/********************************************************
|
||||
* 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);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Input = analogRead(0);
|
||||
myPID.Compute();
|
||||
analogWrite(3,Output);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user