Kode Program Untuk Led Matrix p10
Kode Program Untuk Led Matrix p10
Kelas : 12 RPL
Kode Program untuk led matrix p10
#include <SPI.h> //SPI.h must be included as DMD is written by SPI (the IDE complains
otherwise)
#include <DMD.h> //
#include <TimerOne.h> //
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
/*--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
--------------------------------------------------------------------------------------*/
void ScanDMD()
dmd.scanDisplayBySPI();
/*--------------------------------------------------------------------------------------
setup
--------------------------------------------------------------------------------------*/
void setup(void)
//initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
/*--------------------------------------------------------------------------------------
loop
--------------------------------------------------------------------------------------*/
void loop(void)
byte b;
// 10 x 14 font clock, including demo of OR and NOR modes for pixels so that the
flashing colon can be overlayed
dmd.clearScreen( true );
dmd.selectFont(Arial_Black_16);
delay( 1000 );
delay( 1000 );
delay( 1000 );
delay( 1000 );
dmd.drawChar( 15, 3, ':', GRAPHICS_OR ); // clock colon overlay on
delay( 1000 );
delay( 1000 );
delay( 1000 );
dmd.drawMarquee("Scrolling Text",14,(32*DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret){
ret=dmd.stepMarquee(-1,0);
timer=millis();
dmd.drawTestPattern( PATTERN_ALT_0 );
delay( 1000 );
dmd.drawTestPattern( PATTERN_ALT_1 );
delay( 1000 );
dmd.clearScreen( true );
dmd.selectFont(System5x7);
}
dmd.drawString( 2+(32*x), 1+(16*y), "freet", 5, GRAPHICS_NORMAL );
delay( 2000 );
dmd.clearScreen( true );
delay( 1000 );
// draw an X
int ix=32*x;
int iy=16*y;
delay( 1000 );
// draw a circle
delay( 1000 );
delay( 1000 );
// stripe chaser
{
// stripe chaser
dmd.drawTestPattern( (b&1)+PATTERN_STRIPE_0 );
delay( 200 );
delay( 200 );