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
| Node | Kind | What it does |
|---|---|---|
| Write | Action | Puts a PWM signal on the pin — Duty % of the time on — and holds it until the next action on the pin. |
| Fade | Action | Moves the pin's duty smoothly to To over Duration, then holds it — a LED fading in or out, a motor easing up. |
| Stop | Action | Cuts 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
| Setting | Type | Default | What it's for |
|---|---|---|---|
| Pin | Pin (PWM) | — | Required. Board pin the signal goes out on — only PWM-capable pins are listed. |
| Duty | Number (0 to 100) | 50 | Required. 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. |
| Frequency | Number (1 to 40000) | 1000 | Signal frequency, from 1 to 40000 Hz. 1000 suits LEDs; motors run quieter at 20000 (out of hearing); on a buzzer it's the note. |
| Scale | One of: Linear, Perceived brightness | Linear | Advanced. 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. |
| Invert | On / off | Off | Advanced. 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
| Output | Type | What it is |
|---|---|---|
duty | float | The duty set, in % (0–100). |
frequency | int | The 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
| Setting | Type | Default | What it's for |
|---|---|---|---|
| Pin | Pin (PWM) | — | Required. Board pin the signal goes out on — only PWM-capable pins are listed. |
| To | Number (0 to 100) | 100 | Required. The duty to end at, from 0 to 100, in %. |
| Duration | Number (0 to 600000) | 1000 | Required. 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. |
| From | Number (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). |
| Frequency | Number (1 to 40000) | 1000 | Signal frequency, from 1 to 40000 Hz. 1000 suits LEDs; motors run quieter at 20000 (out of hearing); on a buzzer it's the note. |
| Scale | One of: Linear, Perceived brightness | Linear | Advanced. 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. |
| Invert | On / off | Off | Advanced. 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
| Output | Type | What it is |
|---|---|---|
duty | float | The duty it ended at (To), in %. |
Stop
Cuts the signal and frees the pin.
Settings
| Setting | Type | Default | What it's for |
|---|---|---|---|
| Pin | Pin (PWM) | — | Required. Board pin the signal goes out on — only PWM-capable pins are listed. |
| Hold Low | On / off | LOW after | Drive the pin LOW after stopping, so what's on it stays off. Off: the pin is left floating (an input). |