Normally, an H-Bridgge will have a direction GPIO line and a PWM line to control the speed.
Do you have schematics available? It's hard to know what exactly needs to be done without knowing exactly how things are wired up.
I2C , Robit Elecfreaks
-
- Posts: 9
- Joined: Mon Sep 23, 2019 4:38 pm
Re: I2C , Robit Elecfreaks
No i have not any schematics. I have wrote to Electfreaks but they never answer.
I just hope that somebody who can understant the program:
https://github.com/Tinkertanker/pxt-rob ... r/robit.ts
Could understant how i can do.
I just hope that somebody who can understant the program:
https://github.com/Tinkertanker/pxt-rob ... r/robit.ts
Could understant how i can do.
Re: I2C , Robit Elecfreaks
Looking at the code, there appears to be 2 PWM lines going to the H-Bridge (rather than a simple direction/PWM) and you control the direction by sending PWM to one line or the other to control the direction.
-
- Posts: 9
- Joined: Mon Sep 23, 2019 4:38 pm
Re: I2C , Robit Elecfreaks
thank you
i have find the solution. Indeed each motor is controled by 2 groups of 4 registers.
I show the program :
from microbit import *
print(i2c.scan())
sleep(20)
i2c.write(64, b'\x00\x20') # Mode1: bit5=1(auto increment enable)
# motor 1 (x06 and x0A), duty cycle = 50%, start on = 0 start off= 2047
# LED0_ON_L + LED0_ON_H = 0 LED0_OFF_L + LED0_OFF_H =7FF (2047)
i2c.write(64, b'\x06\x00\x00\xFF\x07') # rotation foward
i2c.write(64, b'\x0A\x00\x00\x00\x00') # rotation reverse
# motor 2 (x0E and x12), duty cycle = 50%, start on = 0 start off= 2047
# LED0_ON_L + LED0_ON_H = 0 LED0_OFF_L + LED0_OFF_H =7FF (2047)
i2c.write(64, b'\x0E\x00\x00\xFF\x07') # rotation reverse
i2c.write(64, b'\x12\x00\x00\x00\x00') # rotation foward
i2c.write(64, b'\x06')
print(i2c.read(64, 16))
I am really happy . Tank's a lot. I think you can write "Resolved"
François
i have find the solution. Indeed each motor is controled by 2 groups of 4 registers.
I show the program :
from microbit import *
print(i2c.scan())
sleep(20)
i2c.write(64, b'\x00\x20') # Mode1: bit5=1(auto increment enable)
# motor 1 (x06 and x0A), duty cycle = 50%, start on = 0 start off= 2047
# LED0_ON_L + LED0_ON_H = 0 LED0_OFF_L + LED0_OFF_H =7FF (2047)
i2c.write(64, b'\x06\x00\x00\xFF\x07') # rotation foward
i2c.write(64, b'\x0A\x00\x00\x00\x00') # rotation reverse
# motor 2 (x0E and x12), duty cycle = 50%, start on = 0 start off= 2047
# LED0_ON_L + LED0_ON_H = 0 LED0_OFF_L + LED0_OFF_H =7FF (2047)
i2c.write(64, b'\x0E\x00\x00\xFF\x07') # rotation reverse
i2c.write(64, b'\x12\x00\x00\x00\x00') # rotation foward
i2c.write(64, b'\x06')
print(i2c.read(64, 16))
I am really happy . Tank's a lot. I think you can write "Resolved"
François