Flashlight - Turns the device's flash on and off with timer, blinking mode, and SOS flashing.

Flashlight
Turns the device's flash on and off with timer, blinking mode, and SOS flashing.
Gif

GIF_20250713_060023_136


TurnOnFlash

Turns on the device's flashlight.

component_method


TurnOffFlash

Turns off the device's flashlight.

component_method (1)


TurnOnFlashForDuration

Turns on the flashlight for a specified duration (in milliseconds) and automatically turns it off afterward.


FlashSpeed

Sets the flashing speed (in milliseconds) for strobe mode.

blocks (9)


StartFlashing

Starts the flashlight strobe (blinking) mode.

component_method (2)


StopFlashing

Stops the flashlight strobe (blinking) mode.

component_method (3)


StartSOS

Activates the SOS emergency signal (Morse code pattern).

component_method (4)


StartCustomPattern

Plays a custom flash pattern (list of millisecond durations).

Example:

If the pattern [300, 700] is entered:

  • The flash is turned on for 300 ms.
  • It is turned off for 700 ms.
  • It repeats indefinitely until the StopFlashing function is called.

Another example:

If you use the pattern [300, 700, 200, 1000, 100]:

Pattern Cycle:

  • On for 300 ms.
  • Off for 700 ms.
  • On for 200 ms.
  • Off for 1000 ms.
  • On for 100 ms.
  • Off for 300 ms. Return to the beginning of the pattern!
  • On for 700 ms.
  • Off for 200 ms.
    And so on until stopped with StopFlashing.

Each value in the list alternates between on and off. An even number (0, 2, 4) is on, and an odd number (1, 3, 5) is off.


IsFlashOn

Returns the current flashlight state (on/off).

component_method (5)


IsFlashing

Returns whether strobe (blinking) mode is active.

component_method (6)


FlashStateChanged

Triggered when the flashlight state changes (on/off).


FlashError

Triggered when a flashlight error occurs.


FlashingStarted

Triggered when strobe (blinking) mode starts.


FlashingStopped

Triggered when strobe (blinking) mode stops.


SOSStarted

Triggered when SOS mode starts.


CustomPatternStarted

Triggered when a custom flash pattern starts.


v1.0 July 13, 2025.

Flashlight.aia (13.1 KB)

joejsanz.joedevflashlight.aix (9.5 KB)


JDK: 11
Minimum API Level: 21
Updated On: 2025-07-13T07:00:00Z

Built using: FAST-CLI v3.8.1-premium


Thanks.

2 Likes

Honestly, how many extensions do you create per week?!

However I have a question: for the custom pattern function, logically the first element will be the ignition duration, the second the empty duration etc. Does it work well like that?

Thanks,
Nico

PS: Can you remove the GIF at the beginning or just move it further down the post? It hurts your eyes when you open it directly! :joy:

I have several extensions that are missing some details and I've been reworking them, and I have some that I made a while ago but haven't published yet.

That's exactly how it works.

So what is the lamp off time between each on time?

@nico
I have updated the information with examples.