Reference for Wiring version 0024+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.
| Class | Matrix |
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Name | write() |
||||||||||
| Examples | #include "Binary.h"
#include "Sprite.h"
#include "Matrix.h"
Matrix myMatrix = Matrix(0, 2, 1);
void setup()
{
}
void loop()
{
myMatrix.clear(); // clear display
delay(1000);
// turn some pixels on
myMatrix.write(1, 5, HIGH);
myMatrix.write(2, 2, HIGH);
myMatrix.write(2, 6, HIGH);
myMatrix.write(3, 6, HIGH);
myMatrix.write(4, 6, HIGH);
myMatrix.write(5, 2, HIGH);
myMatrix.write(5, 6, HIGH);
myMatrix.write(6, 5, HIGH);
delay(1000);
}#include "Binary.h"
#include "Sprite.h"
#include "Matrix.h"
Matrix myMatrix = Matrix(0, 2, 1);
/* create a new Sprite instance
8 pixels wide, 4 pixels tall
*/
Sprite wave = Sprite(
8, 4,
b00011000,
b00100100,
b01000010,
b10000001
);
void setup()
{
}
int x = 0;
void loop()
{
myMatrix.write(x, 2, wave); // place sprite on screen
myMatrix.write(x - 8, 2, wave); // place sprite again, elsewhere on screen
delay(75); // wait a little bit
myMatrix.clear(); // clear the screen for next animation frame
if(x == 8) // if reached end of animation sequence
{
x = 0; // start from beginning
}
x++; // advance x coordinate to the right
} |
||||||||||
| Description | The write(x, y, value) method is used to set individual pixels on or off. Pixel locations are specified in x, y coordinates and the state of a pixel can be HIGH or LOW. The write(x, y, sprite) method is used to write the pixel data tored on sprite, this is very useful when creating animations. | ||||||||||
| Syntax | matrix.write(x, y, value) matrix.write(x, y, sprite) |
||||||||||
| Parameters |
|
||||||||||
| Returns | None | ||||||||||
| Usage | Application |

