Henglos IO
Built-in packages

PWM

A PWM signal on a pin — for dimming a LED, setting a DC motor's speed (through a driver or transistor), driving a buzzer.

A PWM signal on a pin — for dimming a LED, setting a DC motor's speed (through a driver or transistor), driving a buzzer. Write sets a duty and holds it, Fade moves to one smoothly over a time, Stop cuts the signal. For servos, use the Servo component.

@henglosio/component-pwmv1.0.0platform ^1.0.0
NodeKindWhat it does
WriteActionPuts a PWM signal on the pin — Duty % of the time on — and holds it until the next action on the pin.
FadeActionMoves the pin's duty smoothly to To over Duration, then holds it — a LED fading in or out, a motor easing up.
StopActionCuts the signal and frees the pin.

Actions

Write

Puts a PWM signal on the pin — Duty % of the time on — and holds it until the next action on the pin.

Settings

SettingTypeDefaultWhat it's for
PinPin (PWM)—Required. Board pin the signal goes out on — only PWM-capable pins are listed.
DutyNumber (0 to 100)50Required. How much of the time the pin is on, from 0 (off) to 100 (fully on), in %. Decimals are fine (12.5). Bind it to follow a sensor.
FrequencyNumber (1 to 40000)1000Signal frequency, from 1 to 40000 Hz. 1000 suits LEDs; motors run quieter at 20000 (out of hearing); on a buzzer it's the note.
ScaleOne of: Linear, Perceived brightnessLinearAdvanced. How Duty maps to the signal. Perceived brightness follows how the eye sees light, so a LED dims evenly (50% looks half as bright); keep Linear for motors and buzzers.
InvertOn / offOffAdvanced. On for a load that's on when the pin is LOW — a LED wired from 3.3 V to the pin, an active-low driver. 100% is then fully on.

Publishes

OutputTypeWhat it is
dutyfloatThe duty set, in % (0–100).
frequencyintThe frequency set, in Hz.

Fade

Moves the pin's duty smoothly to To over Duration, then holds it — a LED fading in or out, a motor easing up.

Settings

SettingTypeDefaultWhat it's for
PinPin (PWM)—Required. Board pin the signal goes out on — only PWM-capable pins are listed.
ToNumber (0 to 100)100Required. The duty to end at, from 0 to 100, in %.
DurationNumber (0 to 600000)1000Required. How long the fade takes, in milliseconds — 0 jumps straight to To, up to 600000 (10 minutes). The flow waits for it, like a Delay.
FromNumber (0 to 100)—Advanced. The duty to start at, from 0 to 100, in %. Leave it empty to start where the pin is now (what the last Write or Fade left it at — 0 if none).
FrequencyNumber (1 to 40000)1000Signal frequency, from 1 to 40000 Hz. 1000 suits LEDs; motors run quieter at 20000 (out of hearing); on a buzzer it's the note.
ScaleOne of: Linear, Perceived brightnessLinearAdvanced. How Duty maps to the signal. Perceived brightness follows how the eye sees light, so a LED dims evenly (50% looks half as bright); keep Linear for motors and buzzers.
InvertOn / offOffAdvanced. On for a load that's on when the pin is LOW — a LED wired from 3.3 V to the pin, an active-low driver. 100% is then fully on.

Publishes

OutputTypeWhat it is
dutyfloatThe duty it ended at (To), in %.

Stop

Cuts the signal and frees the pin.

Settings

SettingTypeDefaultWhat it's for
PinPin (PWM)—Required. Board pin the signal goes out on — only PWM-capable pins are listed.
Hold LowOn / offLOW afterDrive the pin LOW after stopping, so what's on it stays off. Off: the pin is left floating (an input).

On this page