Arduino UNO Q - Blink multiple LED

Making multiple LEDs blink independently at different speeds is a common and visually satisfying Arduino task. In this tutorial, you will learn how to program the Arduino UNO Q to blink two, three, or more LEDs simultaneously — each at its own pace — without using delay().

In this tutorial, you will learn:

Arduino UNO Q - Blink Multiple LEDs

Hardware Preparation

1×Arduino UNO Q
1×USB Cable for Arduino Uno Q
3×LED
3×220 ohm Resistor
1×Breadboard
1×Jumper Wires
1×Recommended: Screw Terminal Block Shield for Arduino Uno
1×Recommended: Sensors/Servo Expansion Shield for Arduino Uno
1×Recommended: Breadboard Shield for Arduino Uno
1×Recommended: Enclosure for Arduino Uno
1×Recommended: Prototyping Base Plate & Breadboard Kit for Arduino UNO

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of LED

Learn about the LED (pinout, how it works, how to program) in the Arduino UNO Q - LED tutorial.

Wiring Diagram

The wiring diagram between Arduino UNO Q Multiple LED

This image is created using Fritzing. Click to enlarge image

Linux + MCU Bridge Programming

The Arduino UNO Q has two processors that work together: the MPU (Qualcomm, runs Debian Linux) and the MCU (STM32, runs Zephyr OS with your Arduino sketch). They communicate using RPC via the Arduino_RouterBridge library — never via raw serial ports.

  • The LEDs are connected to the MCU (STM32) — wired to digital pins on the STM32. The MCU blinks them using the ezLED library with non-blocking timing.
  • The MPU cannot control the LEDs directly — it must send commands to the MCU via Bridge.call(). The MCU executes the registered Bridge.provide_safe() functions.
  • The MPU has Wi-Fi — because the MPU runs full Debian Linux with Wi-Fi, it can receive Telegram commands and control LED patterns remotely.
  • Communication: Bridge.call() on the Linux side invokes Bridge.provide_safe() functions on the MCU side
  • ⚠️ Reserved: /dev/ttyHS1 (Linux) and Serial1 (MCU) are used by the Arduino Router — never open them directly

In short: MPU sends blink pattern commands → MCU receives them → MCU updates LED blink patterns in real time.

MCU sketch — multiple LEDs with remote blink control:

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-blink-multiple-led */ #include "Arduino_RouterBridge.h" #include <ezLED.h> #define NUM_LED 3 #define PIN_LED_1 7 #define PIN_LED_2 8 #define PIN_LED_3 9 ezLED ledArray[NUM_LED] = { ezLED(PIN_LED_1), ezLED(PIN_LED_2), ezLED(PIN_LED_3) }; void setup() { Bridge.begin(); Monitor.begin(); // Start default blink patterns ledArray[0].blink(800, 200); ledArray[1].blink(500, 500); ledArray[2].blink(500, 500, 500); Bridge.provide_safe("set_blink", set_blink); Bridge.provide_safe("stop_all", stop_all); Monitor.println("Multiple LED Bridge ready"); } void loop() { for (int i = 0; i < NUM_LED; i++) ledArray[i].loop(); } // led_num: 0, 1, or 2; on_ms and off_ms in milliseconds void set_blink(int led_num, int on_ms, int off_ms) { if (led_num >= 0 && led_num < NUM_LED) ledArray[led_num].blink(on_ms, off_ms); } void stop_all() { for (int i = 0; i < NUM_LED; i++) ledArray[i].cancel(); }

Python script (Arduino App Lab) — control LED patterns from Linux:

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-blink-multiple-led */ from arduino.app_utils import * import time def loop(): print("Pattern 1: All LEDs fast") Bridge.call("set_blink", 0, 200, 200) Bridge.call("set_blink", 1, 200, 200) Bridge.call("set_blink", 2, 200, 200) time.sleep(3) print("Pattern 2: All LEDs slow") Bridge.call("set_blink", 0, 1000, 1000) Bridge.call("set_blink", 1, 1000, 1000) Bridge.call("set_blink", 2, 1000, 1000) time.sleep(3) print("Pattern 3: Different speeds") Bridge.call("set_blink", 0, 800, 200) Bridge.call("set_blink", 1, 500, 500) Bridge.call("set_blink", 2, 200, 800) time.sleep(3) print("Stopping all LEDs") Bridge.call("stop_all") time.sleep(2) App.run(user_loop=loop)
  • Note: Make sure Bridge.begin() is called in the MCU sketch and the sketch is uploaded before running the Python script on the Linux side.
  • ⚠️ Warning: Never directly open /dev/ttyHS1 (on Linux) or use Serial1 (on MCU) in your code — these are reserved by the Arduino Router and accessing them will break the Bridge.

Detailed Instructions

  • Upload the MCU sketch: Open Arduino App Lab, create a new App, paste the Bridge MCU sketch above into sketch/sketch.ino, install the ezLED and Arduino_RouterBridge libraries, and click Run.
  • Add the Python script: Paste the Python code above into the Python tab of the same App.
  • Run the App: Click Run — the Python side cycles through different blink patterns automatically.
  • Check the console: Open the Console tab → Python Console subtab to see which pattern is active.
  • Pro Tip: Call Bridge.call("stop_all") from Python to stop all LEDs at once.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Pattern 1: All LEDs fast Pattern 2: All LEDs slow Pattern 3: Different speeds Stopping all LEDs

Telegram Integration

You can control each LED's blink pattern remotely over Telegram — set individual blink speeds or stop all LEDs from anywhere.

If you do not have a Telegram bot yet, see How to Create a Telegram Bot to get your bot token before continuing.

This section covers:

  • Running a Python script on the Linux side of Arduino UNO Q to listen for Telegram messages
  • Forwarding blink pattern commands to individual LEDs on the MCU side via Bridge.call()
  • Sending a confirmation reply back to Telegram

MCU sketch: Keep the same MCU sketch from the previous Bridge section — no changes needed. Make sure it is already uploaded and running on the STM32 before proceeding.

Python script (Arduino App Lab) — Telegram bot for multiple LED control:

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-blink-multiple-led */ from arduino.app_utils import * import requests import time BOT_TOKEN = "YOUR_BOT_TOKEN" API_URL = f"https://api.telegram.org/bot{BOT_TOKEN}" last_update_id = 0 def send_message(chat_id, text): requests.post(f"{API_URL}/sendMessage", json={"chat_id": chat_id, "text": text}) def get_updates(): global last_update_id resp = requests.get(f"{API_URL}/getUpdates", params={"offset": last_update_id + 1, "timeout": 5}) return resp.json().get("result", []) def loop(): global last_update_id updates = get_updates() for update in updates: last_update_id = update["update_id"] msg = update.get("message", {}) chat_id = msg.get("chat", {}).get("id") text = msg.get("text", "").strip() if text.startswith("/blink "): parts = text.split() try: led_num = int(parts[1]) - 1 # user sends 1-3, code uses 0-2 on_ms = int(parts[2]) off_ms = int(parts[3]) Bridge.call("set_blink", led_num, on_ms, off_ms) send_message(chat_id, f"LED {led_num + 1} blinking: {on_ms}ms ON, {off_ms}ms OFF") except (ValueError, IndexError): send_message(chat_id, "Usage: /blink <led 1-3> <on_ms> <off_ms>") elif text == "/stop": Bridge.call("stop_all") send_message(chat_id, "All LEDs stopped") else: send_message(chat_id, "Commands:\n/blink <led> <on_ms> <off_ms> — set blink pattern\n/stop — stop all LEDs\n\nExample: /blink 1 800 200") time.sleep(1) App.run(user_loop=loop)
  • Note: Replace YOUR_BOT_TOKEN with the token obtained from @BotFather on Telegram.
  • Send /blink 1 800 200 to blink LED 1 with 800ms ON and 200ms OFF.
  • Send /stop to stop all LEDs at once.

Detailed Instructions

  • Upload the MCU sketch: Use the Bridge MCU sketch from the previous section (upload it first if not already done).
  • Paste the Telegram script: Copy the Python code above into the Python tab of your App in Arduino App Lab.
  • Set your token: Replace YOUR_BOT_TOKEN in the script with your actual bot token.
  • Run the App: Click Run — the bot starts listening for Telegram messages immediately.
  • Test it: Send /blink 2 300 300 to LED 2 blink fast, or /stop to turn all off.
  • Pro Tip: Send /blink 1 100 100 for a very fast strobe effect on LED 1.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 12:00:01] Telegram: /blink 1 800 200 [2026-04-29 12:00:01] LED 1 blinking: 800ms ON, 200ms OFF [2026-04-29 12:02:10] Telegram: /blink 3 200 200 [2026-04-29 12:02:10] LED 3 blinking: 200ms ON, 200ms OFF [2026-04-29 12:05:30] Telegram: /stop [2026-04-29 12:05:30] All LEDs stopped
Telegram
Telegram 12:45
Welcome to Telegram!
ArduinoBot 10:19
Chatting with Arduino...
telegram-botfather
BotFather Yesterday
Your bot has been created.

ArduinoBot

bot
Today
/blink 1 800 200
10:15 AM ✓✓
LED 1 blinking: 800ms ON, 200ms OFF
10:16 AM
/blink 3 200 200
10:17 AM ✓✓
LED 3 blinking: 200ms ON, 200ms OFF
10:18 AM
/stop
10:19 AM ✓✓
All LEDs stopped
10:20 AM

OpenClaw Integration

OpenClaw integration for Arduino UNO Q with multiple LED control is coming soon.

  • Coming Soon: OpenClaw support for controlling multiple LEDs on Arduino UNO Q will be covered in a future update.

Application/Project Ideas

Here are some project ideas you can build with multiple LEDs and Arduino UNO Q:

  • Telegram-controlled light show: Set different blink patterns for each LED via Telegram and create a custom light display
  • Traffic light simulator: Use red, yellow, and green LEDs with timed blink patterns controlled from Python
  • System status panel: Each LED represents a different service status — blink fast for warning, steady for OK, off for stopped
  • Morse code transmitter: Blink each LED with a different encoded message simultaneously
  • LED sequencer: Have the Python side cycle LEDs in a chase pattern by turning them on and off in sequence

Challenge Yourself

Try these challenges with multiple LEDs and Arduino UNO Q:

  • Easy: Add a fourth LED to the sketch and set it to blink at 250ms ON, 750ms OFF
  • Medium: Extend the Bridge sketch to expose a get_state(int led_num) function that returns whether an LED is currently ON or OFF
  • Advanced: Build a Telegram bot that accepts a named pattern (e.g., /pattern chase) and applies a preset blink sequence across all three LEDs

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!