Modes of Operation
Each digital I/O pins of the board can be configured either as input or output. Output pins can be either digital (on / off), setup to generate a PWM at different frequencies or control a WS28XX RGB led.
Digital output
Digital output pins are set low by sending 0
. Any other value in the range
1
โโโ65535
sets it high.
PWM frequencies and resolution
Not all pins can do PWM. The following table summarizes the characteristics of each pins, for the supported boards
Pin # | Frequencies | Resolution (bits) |
---|---|---|
3, 11 |
|
|
5, 6 |
|
|
9, 10 |
|
|
|
|
|
|
|
Pin # | Frequencies | Resolution (bits) |
---|---|---|
4 |
|
|
9, 10 |
|
|
2, 3, 5-13, 44-46 |
|
|
|
|
|
|
|
The PWM duty cycle is set proportionally to the 16 bits sent value: 0
represents 0% duty cycle (PWM off), 32767
would be 50% and 65535
is 100%
duty cycle (PWM always high).
WS28XX RGB led
On each pin, up to 16 (chained) leds can be addressed (4 bits). Each color channel of each led is coded on 4 bits. The 16 bits value sent to the corresponding pin is interpreted according to the following table.
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
For instance, 0xfff
sets LED #0 to pure white, 0x1800
sets LED #1 to green
at 50% instensity, etc.