Actuator

๐Ÿ’ก LED

๐Ÿ“Œ Description

A LED is a tiny light that turns on when it gets power. Itโ€™s like a mini lamp that can shine in different colors.

๐ŸŽฏ Use

In our projects, LEDs are used to:

  • Show that the robot is on.
  • Blink as a signal when something happens.
  • Create fun light effects with colors.

๐Ÿ‘‰ Think of the LED as the robotโ€™s eyes โ€” they shine to warn, decorate, or communicate.

Module parameters

Pin nameDescription
GGND (Power Input Negative)
VVCC (Power Input Cathode)
SDigital signal pins
  • Supply voltage: 3.3V/5V

  • Connection: PH2.0 3P terminal wire

  • Installation method: double screw fixing

๐Ÿ–ฅ๏ธ Code Explanation

import machine
import time

pin2 = machine.Pin(2, machine.Pin.OUT)
while True:
    pin2.value(1)
    time.sleep(1)
    pin2.value(0)
    time.sleep(1)

Step by Step

  1. import machine โ†’ This brings in the tools to control the pins of the board.
  2. import time โ†’ This lets us pause the program for a chosen amount of seconds.
  3. pin2 = machine.Pin(2, machine.Pin.OUT) โ†’ We tell the board that pin number 2 will be used to control something (in this case, the LED) and that it will send signals out.
  4. while True: โ†’ This starts a loop that repeats forever.
  5. pin2.value(1) โ†’ Turns the LED on (sends power to pin 2).
  6. time.sleep(1) โ†’ Waits for 1 second.
  7. pin2.value(0) โ†’ Turns the LED off (stops sending power).
  8. time.sleep(1) โ†’ Waits for 1 second again.
    ๐Ÿ‘‰ Together, these steps make the LED blink: on for 1 second, off for 1 second, repeating forever.

โœ… Conclusion of the Test

  • If the LED blinks on and off every second, the program is working correctly.
  • This simple test shows that the board can control the LED and follow instructions.
  • Itโ€™s the first step in learning how to make the robot โ€œtalkโ€ with lights โ€” later we can change the speed, patterns, or even use multiple LEDs for more effects.
On this page