Finally getting around to some of the labs I neglected. The servo lab is certainly fun. I wanted to mount two servos on a welding hat to make the visor go up and down based on some sensory input. Further down the line I might use this as a jaw mechanism for a mask, and have the data controlling the servos come from the jaw of the person wearing it. Classic animatronics. I’m using a light detecting resistor in this video.
I made this system using both the servo library and the “pulse method” outlined on this page. To get the servos to move in opposite directions, I reversed the values of one of the servos in the map() function. For example, from the pulse method:
pulse1 = map(analogValue,890,660,minPulse,maxPulse); pulse2 = map(analogValue,660,890,minPulse,maxPulse);
I constrained the values to match the values received by the LDR. Next I will smooth the values so the servos aren’t jumping around as much.