I would like to power 1 Servo and 2 DC Motors using the OpenMV. I connected a 3.7V battery.
Using the motor-shield-pwm.py example, I can power 2 DC motors. Using the servo-control.py example, I can power 1 servo motor on pin 9. According to the documentation, the motor shield does not use pin 9.
However, when I insert the following code to the top of motor-shield-pwm.py…
from pyb import Servo
s3 = Servo(3) # P9
s3.pulse_width(1000)
… the servo doesn’t move. It seems like the OpenMV is unable to configure both the Servo and the Motor Shield, despite the fact that they should be using completely separate pins. Please advise.
I have similiar configuration: one DC motor which I control using motor shield and one servo (sg90) controlling using regular servo 3 pin, but I own regular H7 cam.
Anyway here’s the code:
import time
from pyb import Servo
from tb6612 import Motor
#s1 = Servo(1) # P7
#s2 = Servo(2) # P8
s3 = Servo(3) # P9
m1 = Motor(1) # motor 1: A0 and A1
while(True):
s3.angle(0)
time.sleep_ms(2000)
s3.angle(90)
time.sleep_ms(2000)
s3.angle(120)
time.sleep_ms(2000)
m1.set_speed(50) # Forward
time.sleep_ms(3000)
m1.set_speed(0) # Forward
time.sleep_ms(3000)
When I comment code for DC motor then servo will work without problem. What could be the problem?
Can motor shield and 3-wire hobby servo work in the same time? I forgot to mention that I use 24V DC DSE38BE27-001 (https://www.majju.com/product/dse38be27-001-dc-servo-motor-24v/)motor. Servo, dc and OpenMV share same ground. Everthing is powered using 5V 2A adapter.