After failing to find anything on the forums or wiki for using the servos on Hannah, I was able to figure it out (actually it was the old Lua code on the wiki that helped, so I lied).
Anyway, working on the servos is pretty simple once you get the pin turned on. I didn’t realize you had to turn it on and set the direction.
Here’s the final code snipped that works:
hardware.pin5.configure(DIGITAL_IN); //may not be needed. Found a bug on the forums that this will deal with
ioexp_setdir(10, 1) //make the servo power pin an output
ioexp_setpin(10, 1);//enable servo power for both servos
hardware.pin5.configure(PWM_OUT_STEPS, 0.020, 0.5, 1000); // PWM period ~= 0.02s, duty cycle 0.5, 1000 steps from 0.0 to 1.0
hardware.pin5.write(0.0); //set pwm at zero to disable the servo for now (this could be done in the above line)
to update the servo, send something like this:
hardware.pin5.write(0.05); // sets servo to min position (1000 microseconds)
hardware.pin5.write(0.1); // sets servo to max position (2000 microseconds)
I had tried this with more frequent updates, but the servo freaked out. These numbers work well. Servos only need updates at like 50hz so this is fine.
These are all for servo # 1 (pin 5 pwm). Servo # 2 would be pin 7. The power switched on both servos tho.