Skip to content

Commit ed3ad46

Browse files
authored
Merge pull request #1364 from arduino/jacobhylen/update-led-matrix
[MKC-1210] Revise LED Matrix API docs
2 parents f47f15f + 1ac561c commit ed3ad46

File tree

1 file changed

+65
-50
lines changed
  • content/hardware/02.hero/boards/uno-r4-wifi/tutorials/led-matrix

1 file changed

+65
-50
lines changed

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/led-matrix/led-matrix.md

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -381,93 +381,108 @@ Have fun creating interactive interfaces or animation on your UNO R4 WiFi!
381381

382382
To write more advanced sketches on your own, you may use the full API of the library as found below.
383383

384-
Members | Descriptions
385-
--------------------------------|---------------------------------------------
386-
`public ` [`ArduinoLEDMatrix`](#)`()` | The main class for controlling the LED matrix.
387-
`public void` [`autoscroll`](#)`(int32_t interval_ms)` | Sets the time in ms for each frame to be displayed.
388-
`public void` [`on`](#)`(size_t pin)` | Turn an individual pixel on.
389-
`public void` [`off`](#)`(size_t pin)` | Turn an individual pixel off.
390-
`public void` [`begin`](#)`()` | Start the LED matrix.
391-
`public void` [`next`](#)`()` | Manually move to the next frame in the sequence.
392-
`public void` [`loadFrame`](#)`(const uint32_t buffer[3])` | Load a new single frame that is not in any sequence.
393-
`public void` [`renderFrame`](#)`(uint8:t frameNumber)` | Render the loaded frame.
394-
`public void` [`play`](#)`(bool loop = false)` | Start playing the sequence of frames, with the option to loop indefinitely or play once.
395-
`public bool` [`sequenceDone`](#)`()` | checks if the sequence has finished playing.
396-
`public void` [`loadPixels`](#)`(uint8_t *arr, size_t size)` |Loads the pixels into the buffer but does not display them.
397-
`public void` [`loadWrapper`](#)`(`[`const uint32_t frames[][4], uint32_t howMany`](#)` callback)` | Sets the current frame to number 0 in the sequence.
384+
Members | Descriptions
385+
---------------------------------------------------------------|---------------------------------------------
386+
`public ` [`ArduinoLEDMatrix`](#)`()` | The main class for controlling the LED matrix.
387+
`public void` [`autoscroll`](#)`(int32_t interval_ms)` | Sets the time in ms for each frame to be displayed.
388+
`public void` [`begin`](#)`()` | Start the LED matrix.
389+
`public void` [`next`](#)`()` | Manually move to the next frame in the sequence.
390+
`public void` [`loadFrame`](#)`(const uint32_t buffer[3])` | Load a new single frame that is not in any sequence.
391+
`public void` [`renderFrame`](#)`(uint8:t frameNumber)` | Render the loaded frame.
392+
`public void` [`loadSequence`](#)`(const uint32_t frames[][4])`| Loads an animation sequence into the buffer but does not display it.
393+
`public void` [`play`](#)`(bool loop = false)` | Start playing the sequence of frames, with the option to loop indefinitely or play once.
394+
`public bool` [`sequenceDone`](#)`()` | checks if the sequence has finished playing.
398395

399396
## Members
400397

401-
**public ArduinoLEDMatrix()**
398+
### `ArduinoLEDMatrix()`
402399

403-
Construct a new `LEDMatrix` object.
400+
Construct a new LED matrix object. This will be used to access the methods in the library.
404401

405-
**public void autoscroll(int32_t interval_ms)**
406-
407-
Enable autoscrolling through the frames in a sequence.
402+
```
403+
ArduinoLEDMatrix LEDMatrix;
404+
```
408405

409-
**Parameters**
410-
* `interval_ms` Sets the time in milliseconds that should be spent on a frame before switching to the next frame in the sequence.
411406

407+
### `autoscroll()`
412408

413-
**public void on(size_t pin)**
409+
Enable autoscrolling through the frames in a sequence.
414410

415-
Turn on an individual LED.
416411

417412
**Parameters**
418-
* `pin` Defines which LED should be turned on. Accepted values are 0-95.
419-
**public void off(size_t pin)**
420413

421-
Turn off an individual LED.
414+
- `interval_ms` Sets the time in milliseconds that should be spent on a frame before switching to the next frame in the sequence.
422415

423-
**Parameters**
424-
* `pin` Defines which LED should be turned off. Accepted values are 0-95.
425416

426-
**public void begin()**
417+
### `begin()`
427418

428419
Starts the LED matrix.
429420

430-
**public void next()**
421+
```arduino
422+
LEDMatrix.begin()
423+
```
424+
425+
### `next()`
431426

432427
Manually moves to the next frame in the sequence.
433428

434-
**public void loadFrame(const uint32_t buffer[3])**
429+
```
430+
LEDMatrix.next()
431+
```
432+
433+
### `loadFrame()`
434+
435+
Loads a single frame that is not part of a sequence.
435436

436-
loads a single frame that is not part of a sequence.
437+
```arduino
438+
LEDMatrix.loadFrame(buffer[i])
439+
```
437440

438441
**Parameters**
439-
* `buffer[3]` an array of three 32bit integers, where each bit represents an LED.
440442

441-
**public void renderFrame(uint8_t frameNumber)**
443+
- `buffer[3]` an array of three 32bit integers, where each bit represents an LED.
444+
445+
### `renderFrame()`
446+
447+
Render a specific frame from a sequence.
442448

443-
Render a specific frame from a sequence
449+
```
450+
LEDMatrix.renderFrame(frameNumber)
451+
```
444452

445453
**Parameters**
446-
* `frameNumber` Specifies which frame of the sequence should be rendered.
447454

448-
**public void play(bool loop)**
455+
- `int` - frame to load.
449456

450-
Starts playing the loaded sequence.
457+
### `loadSequence()`
451458

452-
**Parameters**
453-
* `loop` true to enable looping the sequence, false to play once.
459+
Loads an animation sequence into the buffer but does not display it.
454460

455-
**public bool sequenceDone()**
461+
```arduino
462+
LEDMatrix.frames[][4]
463+
```
456464

457-
Check for if the sequence is finished playing or if the frame should be advanced another step.
465+
**Parameters**
458466

459-
**Returns**
460-
false if the sequence is not finished, true if it is.
467+
- `frameNumber` Specifies which frame of the sequence should be rendered.
461468

462-
**public void loadPixels(uint8_t arr, size_t size)**
469+
### `play()`
463470

464-
Loads the pixels into the frame but does not load them.
471+
Starts playing the loaded sequence.
472+
473+
```
474+
LEDMatrix.play(state) //true or false
475+
```
465476

466477
**Parameters**
467-
* `arr` Pointer to an array that holds the frame
468478

469-
* `size` the amount of pixels in your frame.
479+
- `loop` true to enable looping the sequence, false to play once.
480+
481+
### `sequenceDone()`
482+
483+
Check for if the sequence is finished playing or if the frame should be advanced another step.
484+
485+
**Returns**
470486

471-
**public void loadWrapper(const uint32_t frames[][4], uint32_t howMany)**
487+
- `false` if the sequence is not finished, `true` if it is.
472488

473-
Sets the current frame to frame 0 in the sequence.

0 commit comments

Comments
 (0)