"It’s Here! The BFCM Sale of the Year – Grab Your Favorites!"

Cutebot Car Breathing Light

Hi, today let’s make a cool breathing light effect to the chassis of the Cutebot. Breathing light means that the light changes gradually from bright to dark under the control of a microcomputer, and it feels like a person is breathing. We can achieve the effect of breathing light through simple programming.

Cutebot Car Breathing Light

Cutebot Car Breathing Light
BBC micro:bit V2 x 1

Cutebot Car Breathing Light
Smart Cutebot Kit : Smart Car Robot kit for micro:bit x 1

Implementation principle:

1.We need to control the brightness to achieve the effect of the breathing light. The effect of the breathing light is actually the process of brightness from weak to strong and then from strong to weak, so we need to constantly change the brightness.

2.Because the maximum brightness is 255, we can cycle through 255 times to increase the brightness of the two Rainbow LEDs at the bottom of the Cutebot from 0 to 255, so the value of each increase is 255/255=1, and if by decreasing, the effect is the same. You can subtract 1 each time. And you can adjust the number of cycles to achieve a cycle effect with different speeds. For example, through 51 cycles, the value changed each time is 255/51=5.

Go to MakeCode: (makecode.microbit.org/)

Cutebot Car Breathing Light

Steps:

1.Go to MakeCode editor: https://makecode.microbit.org/

2.While on start:

Set P15 as the two Rainbow LEDs connection port in the on start brick.

Set the left LED ranging from 0 with 1 LED.

Set the right LED ranging from 1 with 1 LED.

Create a variable named “brightness” and set it with 0.

Cutebot Car Breathing Light

3.Drag a forever block:

Set the left LED in red and the right LED in blue, change the brightness by a step of 1, and then set the brightness of the left LED and the right LED to the variable “brightness” respectively, and refresh them, finally pause for 1ms, repeat this step to 255 seconds, this is the program for the brightness of the breathing light effect from weak to strong. The code for the breathing light effect from strong to weak only needs to change the brightness by -1.

Program:

Cutebot Car Breathing Light

Cutebot Car Breathing Light

Link: https://makecode.microbit.org/_1WuJsxEgWE5s

If you have any ideas or opinions, please feel free to contact us via [email protected].

Leave a Reply

images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
images
Children’s Programming Education is the Future Trend
images
Technical verification! Nezha series products can complete WRO competition tasks
images
Let's take part in the Ceremony of the New Factory of ELECFREAKS together!
images
Bluetooth Bee(HC-05 and HC-06) User Guide
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Monthly Archive