Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Arduino
Can PID control be added to control this algorithm? If so, how? Looking to incorporate but can't figure it out
 

 
#include <Servo.h>
Servo myservo;
int pos = 0;  
int inputPhotoLeft = 1; 
int inputPhotoRight = 0;
int Left = 0; 
int Right = 0; 
{
myservo.attach(9); 
}
void loop()
{
 
Left = analogRead(inputPhotoLeft);
Right = analogRead(inputPhotoRight);
Posted 10-Jan-13 14:36pm
Edited 10-Jan-13 18:42pm
v3
Comments
Christian Graus at 10-Jan-13 20:45pm
   
What language is this ? What are you doing ?
Member 9747032 at 10-Jan-13 20:50pm
   
This is Arduino IDE language. I'm looking to add PID control to this algorithm for fun. The goal is for the servo to follow light based on the input values from photo resistors using PID control
Christian Graus at 10-Jan-13 20:53pm
   
Interesting. Are there forums anywhere with users of this language ? I bet most people here have not heard of it.
Member 9747032 at 10-Jan-13 20:55pm
   
Sorry I forgot to add *C++ language
Christian Graus at 10-Jan-13 20:57pm
   
OK - so tag your question C++ also

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The answer is yes of course it can.
One simple Google search "pid arduino" would have given you this pid library second in the list along with many other pid arduino references.
http://playground.arduino.cc/Code/PIDLibrary[^]
 
Why don't you try this and get back with a specific question.
  Permalink  
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 369
1 Maciej Los 208
2 George Jonsson 144
3 Richard MacCutchan 140
4 Dave Kreskowiak 130


Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid