===== constitution =====
note : fonctionnement par ligne.
{{::arduino.seeed.matrix1632.structure.png|}}
{{::arduino.seeed.matrix1632.adressage.png|}}
===== librairie =====
==== Propriétés ====
^type^identifiant^usage^
^private| |
|uint8_t|clk, r1, stb, oe, a, b, c, d|pins|
|uint8_t[]|*displaybuf|buffer|
|uint16_t|width, height|taille du panneau|
|uint8_t|mask|?|
|uint8_t|state|on/off (0/1)|
^public| |
==== Méthodes ====
^identifiant^paramètres^usage^
^LEDMatrix|a, b, c, d, oe, r1, stb, clk|constructeur|
^begin|*displaybuf, width, height|initialisation ?|
^drawPoint|x, y, pixel|permet d'allumer/éteindre un pixel à une position x,y. pixel = 0/1 (allumé/éteint)|
^drawRect|x1, y1, x2, y2, pixel)|dessine un rectangle. pixel : cf ci-dessus.|
^drawImage|xoffset, yoffset, width, height, *image|dessine une image. *image = ?|
^clear| |“turn off 1/16 leds and turn on another 1/16 leds” ?|
^scan| |?|
^reverse| | inverse les pixels allumés et éteints|
^isReversed| |retourne la valeur de mask|
^on| |turn on the led matrix ?|
^off| |turn off the led matrix ?|
===== Code minimal (proposition) =====
Nécéssite les librairies appropriées
#include "LEDMatrix.h"
#define WIDTH 32
#define HEIGHT 16
LEDMatrix matrix(4, 5, 6, 7, 8, 9, 10, 11); // LEDMatrix(a, b, c, d, oe, r1, stb, clk);
uint8_t displaybuf[WIDTH *HEIGHT / 8]; // Display Buffer
int frequency= 1000;
void setup() {
matrix.begin(displaybuf, WIDTH, HEIGHT);
Serial.begin(9600);
}
void loop() {
static uint32_t lastCountTime = 0;
static uint8_t count = 0;
matrix.scan();
if ((millis() - lastCountTime) > frequency) {
lastCountTime = millis();
// votre code ici
}
}
==== buffer ====
On peut spécifier un buffer :
uint8_t displaybuf[WIDTH *HEIGHT / 8] = {
0x00, 0x00, 0x00, 0x00, // 0
0x00, 0x30, 0x0C, 0x00, // 1
0x00, 0x48, 0x12, 0x00, // 2
0x00, 0x44, 0x22, 0x00, // 3
0x00, 0x43, 0xC2, 0x00, // 4
0x00, 0x40, 0x02, 0x00, // 5
0x00, 0x80, 0x01, 0x00, // 6
0x00, 0x84, 0x09, 0x00, // 7
0x00, 0x8C, 0x59, 0x00, // 8
0x00, 0x80, 0x01, 0x00, // 9
0x00, 0x84, 0x91, 0x00, // 10
0x00, 0x47, 0xF2, 0x00, // 11
0x00, 0x20, 0x04, 0x00, // 12
0x00, 0x1F, 0xF8, 0x00, // 13
0x00, 0x00, 0x00, 0x00, // 14
0x00, 0x00, 0x00, 0x00, // 15
};