I currently have a PIC18F4539 listening for button presses from a 12 key keypad. It is set up so that after you put in the right code and push the unlock button a green LED turns on.
Now I want to add a servo. Everything has gone good so far, but the servo is giving me lots of trouble. I think that the best way to implement the servo would be to use the built in PWM, correct? From what I understand the PWM can run in the background after it is set so that it does not interrupt the rest of the program?
I don't need any advanced servo control. I just want to be able to put it in 2 states. All the way right, and all the way left.
Can someone help me set up the PWM to put the servo in one of those states? Setting up the PWM is still very confusing for me despite the numerous example codes I have looked at.
Any help is much appreciated.
Swordfish + PWM + Servo
Moderators: David Barker, Jerry Messina
I put together a Swordfish module for controlling hobby-type servos which might do what you need. Module, description and sample code are at Digital-DIY