View Single Post
  #4   Spotlight this post!  
Unread 28-01-2004, 18:13
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: PID control loop/Encoder question

well, the PID control loop code you saw on the NRG repository essentially accepts a requested (nominal) PWM value, and the actual PWM value (in your case, from the encoder) - the second two variables are just for storage (note, you could just declare these in the function as static variables instead of declaring them elsewhere and passing them as arguments). It then returns the value that the PWM should be set to. It's essentially that simple - call it with those two values, and set the pwm variable to the return value of the function.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)