Hello,
I’m trying to get a servo to respond using the OpenMV H7. I’ve used the demo code with to no avail and a search of the forums has shown users with the same issues, but none of the resolutions seem to help.
I’m using a very basic micro servo (FITEC) and have tried P7 and P8 on the H7. The servo is being powered by 5V coming from a Raspberry Pi Pico. I have tested the servo (and tried several different servos as well) and am able to get a response if I connect it solely to the Pico and write some simple python code to control it, so I don’t think the servo is the issue. The code is the basic demo code from the IDE. The H7 is working as I am able to get image recognition. The firmware is the latest according to the IDE.
Is there anything I am missing? Any help is greatly apprecaiated.
The code is below. It’s the demo code but I have commented out s3 as the H7 does not support that.
This work is licensed under the MIT license.
Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
https://github.com/openmv/openmv/blob/master/LICENSE
Servo Control Example
This example shows how to use your OpenMV Cam to control servos.
import time
from pyb import Servo
s1 = Servo(1) # P7
s2 = Servo(2) # P8
#s3 = Servo(3) # P9
while True:
for i in range(1000):
s1.pulse_width(1000 + i)
s2.pulse_width(1999 - i)
s3.pulse_width(1000 + i)
time.sleep_ms(10)
for i in range(1000):
s1.pulse_width(1999 - i)
s2.pulse_width(1000 + i)
s3.pulse_width(1999 - i)
time.sleep_ms(10)
Thanks!
Kris