Second motor not working in one direction with Bluetooth projects using crowbit inventor kit
Hi everyone,
I have being testing some of the Bluetooth projects of the kit. I used the Makecode environment (as suggested in the manual) instead of Lets code for the having access to the Bluetooth functions/modules. Once the project is created in Makecode environment I download it to a MicroBit V2 which later I insert in the crowbit platform, then the Bluetooth control is done from the Monitor/control area of the Microbit app.
The Bluetooth link and most of the functions work well, I can run the buzzer, LED module and one DC motor module without problems, but when adding a second DC motor (for example for the Bluetooth Car patrol) this motor only runs in one direction. I have tried to exchange the motors, in case one of them will be broken, but the result is the same, so I guess both motor modules are ok. I have also tried to use a different set of pins attached to the DC motor module, e.g. instead of P2/P3, I have tried with P14/P16 but the problem is still there.
The DC motor modules are only working with P0/P1 set of pins, when I select a different pair of pins (needed for a second DC motor) the error is always there (only running in one direction).
Could it be related with some internal use of the direction signal when using Bluetooth applications?
or Could it be related to the use of MakeCode instead of LetsCode? In applications developed with LestCode (no Bluetooth controlled) the 2 DC motor modules work fine.
Is there any way of implementing the Bluetooth examples using LetsCode? It looks from the picture advertisement that you have an specific App for Bluetooh application control. But I could not find it.
If you have a complete example in LetsCode of a Bluetooth project, I would really appreciate to have it.
Let me know any suggestion,
Best regards
Comments
Just one question more about the issue:
Hello @rava ,
Could you please send your complete code so we can see if there are any problems?
Hello, following the code in python, but it was created using blocks. Motor attached to P0/P1 was working well, the second one (no matter the couple, P2/P3, P5/P8....) only goes in one direction.
def on_gamepad_button_bdown():
pins.digital_write_pin(DigitalPin.P5, 1)
pins.digital_write_pin(DigitalPin.P8, 0)
devices.on_gamepad_button(MesDpadButtonInfo.BDOWN, on_gamepad_button_bdown)
def on_gamepad_button__2_down():
pins.digital_write_pin(DigitalPin.P0, 1)
pins.digital_write_pin(DigitalPin.P1, 0)
devices.on_gamepad_button(MesDpadButtonInfo._2_DOWN, on_gamepad_button__2_down)
def on_gamepad_button_ddown():
music.play(music.string_playable("C5 A B G A F G E ", 125),
music.PlaybackMode.UNTIL_DONE)
devices.on_gamepad_button(MesDpadButtonInfo.DDOWN, on_gamepad_button_ddown)
def on_gamepad_button_cdown():
music.play(music.builtin_playable_sound_effect(soundExpression.happy),
music.PlaybackMode.UNTIL_DONE)
devices.on_gamepad_button(MesDpadButtonInfo.CDOWN, on_gamepad_button_cdown)
def on_gamepad_button_adown():
pins.digital_write_pin(DigitalPin.P5, 0)
pins.digital_write_pin(DigitalPin.P8, 1)
devices.on_gamepad_button(MesDpadButtonInfo.ADOWN, on_gamepad_button_adown)
def on_gamepad_button_bup():
pins.digital_write_pin(DigitalPin.P5, 0)
pins.digital_write_pin(DigitalPin.P8, 0)
devices.on_gamepad_button(MesDpadButtonInfo.BUP, on_gamepad_button_bup)
def on_gamepad_button__1_down():
pins.digital_write_pin(DigitalPin.P0, 0)
pins.digital_write_pin(DigitalPin.P1, 1)
devices.on_gamepad_button(MesDpadButtonInfo._1_DOWN, on_gamepad_button__1_down)
def on_gamepad_button__2_up():
pins.digital_write_pin(DigitalPin.P0, 0)
pins.digital_write_pin(DigitalPin.P1, 0)
devices.on_gamepad_button(MesDpadButtonInfo._2_UP, on_gamepad_button__2_up)
def on_gamepad_button__1_up():
pins.digital_write_pin(DigitalPin.P0, 0)
pins.digital_write_pin(DigitalPin.P1, 0)
devices.on_gamepad_button(MesDpadButtonInfo._1_UP, on_gamepad_button__1_up)
def on_gamepad_button_aup():
pins.digital_write_pin(DigitalPin.P5, 0)
pins.digital_write_pin(DigitalPin.P8, 0)
devices.on_gamepad_button(MesDpadButtonInfo.AUP, on_gamepad_button_aup)
bluetooth.start_io_pin_service()
basic.show_icon(IconNames.GHOST)
For the projects that use two motors, we usually use port 0, 1, 2, and 3. There is a conflict withP5.
Hi,
I also have the same problem if I use P2/P3 as couple for the second motor. Could you share I simple project with bluetooth and the use of the 2 motors?
Thanks in advance.
Best regards
Hello @rava ,
Here're the examples we worte. Hope this will help.