Microbit: Blink and Breath (LED Module)

Overview In this project, we combine project 2 and project 3. You will learn how to control the LED on the module to blink two times, then breath two times, circularly. This time we use keyestudio 3W LED module, which has high brightness and can be used as illumination.

Component Required

  • Micro:bit main board*1
  • Keyestudio Micro bit Sensor V2 Shield*1
  • USB Cable*1
  • Keyestudio PIR Motion Sensor*1
  • Keyestudio 3W LED Module*1
  • Dupont jumper wire*3

Component Introduction
Keyestudio 3W LED Module:
This LED module is of high brightness because its lamp beads are 3w. You can apply this module to Arduino or other projects, ideal for Robot or search and rescue application.

For example, intelligent robots can use this module for illumination purposes.
Please note that the LED light can’t be exposed directly to human eyes for safety concerns.

361-4.png

Specifications (3W LED Module)

  • Color temperature: 6000~7000K
  • Luminous flux: 180~210lm
  • Current: 700~750mA
  • Power: 3W
  • Light angle: 140 degree
  • Working temperature: -50~80โ„ƒ
  • Storage temperature: -50~100โ„ƒ
  • High-power LED module, controlled by IO port of the microcontroller
  • IO Type: Digital
  • Supply Voltage: 3.3V to 5V

DBFamily vlogs
You can also visit our youtube channel for even more interesting videos at the following link.
https://www.youtube.com/@dbfamilyvlogs

GitHub Repo:
You can access the code repo at GitHub at the following link.
https://github.com/dbcoder14/project-4-blink-and-breath

Javascript code block

let val = 0
led.enable(false)
basic.forever(function on_forever() {
    
    while (val < 1024) {
        val = val + 2
        pins.analogWritePin(AnalogPin.P0, val)
        basic.pause(5)
    }
    basic.pause(5)
    while (val > 0) {
        val = val - 2
        pins.analogWritePin(AnalogPin.P0, val)
        basic.pause(5)
    }
})

Python code block

val = 0
led.enable(False)

def on_forever():
    global val
    while val < 1024:
        val = val + 2
        pins.analog_write_pin(AnalogPin.P0, val)
        basic.pause(5)
    basic.pause(5)
    while val > 0:
        val = val - 2
        pins.analog_write_pin(AnalogPin.P0, val)
        basic.pause(5)
basic.forever(on_forever)

Hope you will enjoy the project, see you in the next post.
Abdulsamad & Dad

Author: Danyal
I'm a skilled programmer specializing in Vue.js/Nuxt.js for front-end development and PHP Laravel for back-end solutions. I have a strong focus on API design and development, complemented by experience in web server setup and maintenance. My versatile expertise ensures seamless creation and maintenance of web applications, covering everything from intuitive user interfaces to robust server-side functionality. Passionate about coding and driven by a lifelong learning mindset, I invite you to explore more at danyal.dk.