Wukong board - Turn motor on for 2 seconds

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
vmcduarte
Posts: 5
Joined: Sat Dec 18, 2021 4:33 pm

Wukong board - Turn motor on for 2 seconds

Post by vmcduarte » Sun Jan 02, 2022 5:46 pm

Hello

I am using the Microbit blocks programing.

I want to make a simple code for my kid:

Button A: Set Motors M1 & M2 to turn at 20% for 1 seconds

The code is bellow.

However, the motors keep turning forever and don't stop after 1 sec.

What am I doing wrong?

Thanks!


Image

lujo
Posts: 24
Joined: Sat May 11, 2019 2:30 pm

Re: Wukong board - Turn motor on for 2 seconds

Post by lujo » Sun Jan 02, 2022 7:12 pm

Hi,

If you set the motor speed, the motor starts running.
To stop the motor(s) use the Stop motor or Stop all motor blocks.

Maybe you should do this in MicroPython. The typescript source is at
https://github.com/elecfreaks/pxt-wukon ... er/main.ts.
Should be very easy to translate to MicroPython. Could use the
mu-editor the write the code and flash it to the micro:bit.

lujo

vmcduarte
Posts: 5
Joined: Sat Dec 18, 2021 4:33 pm

Re: Wukong board - Turn motor on for 2 seconds

Post by vmcduarte » Mon Jan 03, 2022 3:55 pm

Thanks!

Post Reply