Skip to content

About

Library for UnitFLASHLIGHT using M5UnitUnified.

Topics

Resources

Stars

2 stars

Watchers

4 watching

Forks

Repository files navigation

M5Unit - FLASHLIGHT

Overview

Library for UnitFlashLight using M5UnitUnified.
M5UnitUnified is a library for unified handling of various M5 units products.

SKU:U152

Unit FlashLight is an output unit with a built-in flashlight, containing an AW3641E driver and a white LED with a color temperature of 5000 ~ 5700K. There is a mode selection switch on the internal PCB that allows you to choose between flash mode and constant light mode, using a GPIO input interface. It can be used as a flash source or for lighting applications.

Mode selection switch (S1)

UnitFlashLight (U152) has an on-board mode selection switch (silkscreen S1, SPDT type) that selects between Flash and Torch mode by wiring the AW3641E FLASH pin to +5V or GND. The switch is not connected to the host MCU and cannot be read from software. Flip it on the PCB before powering the unit:

  • Flash side: use unit.flash(Brightness, duration_ms) — short pulsed flash (<= 220 ms)
  • Torch side: use unit.torch(duration_ms) — steady ~214 mA illumination for the given time, or unit.torchOn() to keep it on until unit.stop()

Power and heat

  • 100% flash draws a large current from the 5 V rail. If the host's battery is low, or the host runs on battery only, it may reset (brownout) at the moment of the flash. Power the host from USB and keep the battery charged.
  • Flash mode heats the unit with each flash. M5Stack recommends an interval of 8 to 15 seconds between flashes (Unit FlashLight document).
  • Torch mode has no hardware timeout. unit.torchOn() keeps the LED on until unit.stop(), and the unit gets hot during long continuous use. Turn it off when it is not needed.

Include file

#include <M5UnitUnifiedFLASHLIGHT.h>

Related Link

Required Libraries

License

Examples

See also examples/UnitUnified

For Arduino IDE settings

FlashDemo runs the Flash demo by default (S1 = Flash side; BtnA click fires a flash, BtnA hold steps the duration). To run the Torch demo (S1 = Torch side; BtnA click turns the LED on / off), uncomment the following line in main/FlashDemo.cpp, or pass -DUSE_TORCH_DEMO as a compile option.

  • FlashDemo
// #define USE_TORCH_DEMO

For ESP-IDF settings

NOTE: The ESP-IDF native build (idf.py) targets ESP-IDF 5.1 or later (5.x and 6.x).

The example needs no Kconfig choice. Build it directly:

cd examples/UnitUnified/UnitFlashLight/FlashDemo
idf.py set-target esp32s3               # or esp32 / esp32c5 / esp32c6 / esp32h2 / esp32p4 / ...
idf.py build flash monitor

To run the Torch demo, uncomment #define USE_TORCH_DEMO in main/FlashDemo.cpp (same as for Arduino IDE).

Support via PbHub

Unit Support Note
UnitFlashLight NG 1-wire EN pulse protocol requires µs-level timing (T_HI/T_LO 0.75–10 µs) that cannot be met over PbHub's I2C hop

See also M5Unit-HUB

Doxygen document

GitHub Pages

If you want to generate documents on your local machine, execute the following command

bash docs/doxy.sh

It will output it under docs/html
If you want to output Git commit hashes to html, do it for the git cloned folder.

Required

About

Library for UnitFLASHLIGHT using M5UnitUnified.

Topics

Resources

Stars

2 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages