Case 2 - Random-color LEDs blink

Part 1 Objective

After you write the program and upload it to mBot, you can turn on your mBot with random-color LEDs blinking.

5456adba-d1eb-4386-9194-d3e09e3cc12f.png

Part 2 Preparation

  • mBot x 1
  • USB cable (Type-B) x 1
  • Computer with network access x 1
  1. Connect mBot to the computer by using the cable.

c6298adb-9667-4ac1-b4e1-6e98fa0e75d6.gif

  1. Open mBlock 5 (PC client or web version), click +add in the lower left Devices area, select mBot from the Device Library, click Connect, and select the Upload mode. (Live mode: you can click on the blocks to see the real-time running effect, but you need to keep the cable connected to the computer. Upload mode: you can upload a program to mBot, and you can unplug the cable to run the program.)

54ed34ea-6665-4666-8589-dbf020743806.gif

Part 3 Programming

After you upload the program to mBot, the on-board LEDs light up with random colors.

5c90364c-c6c3-49ba-8bd8-d4ef9be615fe.gif

Script image

Part 4 Project file

2.Random-color LEDs blink.mblock

Part 5 Practice

  1. Modify the values of the random numbers.
  1. Modify the time interval.

 

Was this article helpful?
2 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.