enhance coding style

This commit is contained in:
francois
2015-05-09 20:20:53 +02:00
parent d46dded42d
commit d7c61d2556
3 changed files with 30 additions and 19 deletions

View File

@ -5,16 +5,20 @@
#include <PID_v1.h>
#define PIN_INPUT 0
#define PIN_OUTPUT 3
//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);
double Kp=2, Ki=5, Kd=1;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
void setup()
{
//initialize the variables we're linked to
Input = analogRead(0);
Input = analogRead(PIN_INPUT);
Setpoint = 100;
//turn the PID on
@ -23,9 +27,9 @@ void setup()
void loop()
{
Input = analogRead(0);
Input = analogRead(PIN_INPUT);
myPID.Compute();
analogWrite(3,Output);
analogWrite(PIN_OUTPUT, Output);
}