Posted: 7/30/2017 9:50:24 PM EDT
|
Anybody know this stuff?
I'm trying to map a digital input to a servo. I have the input working ( I can see the output on the serial monitor) I have the servo working But I dont know shit about C and have no idea how to map them together. If anyone can teach me this I'll buy you a membership, or whatever you want really as long as we agree beforehand. Thanks!!! |
|
https://www.allaboutcircuits.com/projects/servo-motor-control-with-an-arduino/
There is some sample code there. Instead of just looping through angles you can have the button press set the value for angle to say 45 when pressed and 135 when not pressed. Then it will move back and forth when pressed. |
|
What is your range of input values? [Are you getting your input values from an analogRead command or from something else?] - OK, I see that you say that you're getting your value from a 'digital input', but that is not descriptive enough - can you provide more information? A single digital input? Several in parallel? Something else?
Do you want to map those values into the range of 0 to 180 degrees to pass to servo.write()? Or is there a more restrictive mapping range that you want to accomplish, or do you want to invert the mapping (high input gives low output value and vice-versa)? I can try working up an example on my Arduino if you can provide that info. |