The final sketch loop functions as follows: Everytime through the loop, -Read the potentiometer pin using analogRead(potPin) and store the result as ‘val’ -Convert to the pulse length (a number in the range 0 2500 using the map command) ‘val’ – -Create the pulse on the servopin line for 20ms As the potentiometer is changed, the servo motor armature follows the change as expected in a – system. Finally, while this is a very primitive fly-by-wire system, it is functional and was achieved with remarkably few lines of code.
The final sketch loop functions as follows: Everytime through the loop, -Read the potentiometer pin using analogRead(potPin) and store the result as ‘val’ -Convert ‘val’ to the pulse length (a number in the range 0 – 2500 using the map command) -Create the pulse on the servopin line for 20ms As the potentiometer is changed, the servo motor armature follows the change – as expected in a system. Finally, while this is a very primitive fly-by-wire system, it is functional and was achieved with remarkably few lines of code.
Arduino%20Microcontrollers_2014b.docx