Using a switch to control a PWM
I do know C but i am not directly involved with programming, so i apologize if i don't know some obvious things. We are trying to have two switches move a servo (PWM controlled) between two different values. I assumed this would be as simple as checking the status of the button every iteration of the loop and then assigning a certain value to the PWM via an if statement.
if(p1_sw_some_switch == 1){
pwmxxx=some_value
}
if(p1_sw_some_other_switch == 1) {
pwmxxx=some_other_value
This appears to not be working (ie buttons do not move the servo at all, do the servo does appear to twitch when the OI or the RC is turned on) so my first thought was that maybe the switch takes values other than 0 and 1 like maybe 0 and 255, etc. Any help would be much appreciated
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257
2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
|