šŸ”¦Toggle Flashlight on Power Triple-Click

by Pete Glass

Version 2 (March 11, 2019)

Download (35 downloads)

Toggles the camera flash on and off when the power button is pressed three times sequentially within one second (a fast triple-click, subsequent clicks need to be within 0.5 seconds of previous and this delay can be customized in block 76). The number of clicks needed can be set in the ClicksNeeded var, block 82. If the flashlight is still on after 1 minute a dialog appears and asks if you would like to keep the flashlight on and the dialog will timeout after 15 seconds and turn off the flashlight automatically if a response is not received to prevent damage to your camera flash.

Note: Make sure the necessary permissions have been enabled in automate. The valid total time for the subsequent clicks varies depending on the ClickNeeded and Delay variables [(ClickNeeded - 1) * Delay]. For example, for a triple click with a delay of 0.5 seconds the valid time for all clicks is 1 second, for a quadruple click with a delay of 0.5 seconds the valid time for all clicks is 1.5 seconds. If your device cannot detect power button presses, replace the "key pressed" block (block 48) with a "display on?" block with when changed in the block settings making sure all paths that were going into the "key pressed" block are moved to the "display on?" block and connect the yes an no out paths of the "display on?" block to the in path of block 14 and increase the delay variable to 1.5 or 2 seconds.

* * * Created by Pete Glass * * *