The Pulse widget outputs values periodically. By default, it momentarily sends a high (e.g. 1023) value every second (returning to a low value such as 0, 90 milliseconds later). In addition to using fixed amounts for the pulse period and output values, these can be set to random values.
Pulse can be used to blink an LED, send a webhook every so often, or trigger an animation periodically. Using the random features can provide a more natural and interesting kinds of repeating actions.
By default, Pulse sends out values constantly. But the periodic output can be turned on and off by hooking up a widget to the Pulse top input and send a high or low value respectively to Pulse. In addition, the Pulse time period can be set by the second input.
- Output – Connect the output to the widget you want to receive new values each period.
- Pulse enable – Optionally connect the trigger input to the first inlet. When the value from rises above the threshold, the pulses will be enabled.
- Time period input – Optionally connect an input to the second inlet to control the period time.
2 Set the time period
On the left side of the widget next to the second inlet, input a value in milliseconds for the time period between each pulse.
3 Optionally set random features
If instead of fixed time and output values you want random values, do the following:
- Random output value – check the “rand out” checkbox, and in the more section, set the low and high values for the output value range.Note that when “rand out” is selected, the widget no longer pulses the output momentarily. Instead, it outputs a new random value for the entire period.
- Random time period – check the “rand time” checkbox, and in the more section, set the low and high values for the time period.
4 More Options
- Threshold – If you are using a trigger input, when input values are greater than or equal to threshold, the pulse will occur
- % time on – sets the percentage of the pulse time period that the output will be the high (right side) value
- Random out range – When the Rand Out check box is on, these set the low and high range of the random numbers generated
- Random time range – When the Rand Time check box is on, these set the low and high range of the random numbers generated