Coding Arduino Untuk Dot Matrix P10
Coding arduino untuk dot matrix p 10,untuk mnghasilkan karakter atau tulisan di panel dot matrix atau led matrix kalian harus mempunyai program file hex yang di program menggunakan arduino jadi kalo kalian asal asalan tentang membuat kode file hex maka akan terjadi eror alias gagal program
oke kali ini saya akan ber bagi coding kepada kalian semua,tapi ingatya coding ini kusus di program arduino dengan rangkaian led matrik p10 atau bisa di sebut 16x32, ingatya rangkaian arduino dan panel led p10 dan yang paling penting adalah kalian harus benar dalam perangkaian dari panel led dan arduino
silakan kopy code di bawah dan masukkan ke arduino
Perhatian:
oke kali ini saya akan ber bagi coding kepada kalian semua,tapi ingatya coding ini kusus di program arduino dengan rangkaian led matrik p10 atau bisa di sebut 16x32, ingatya rangkaian arduino dan panel led p10 dan yang paling penting adalah kalian harus benar dalam perangkaian dari panel led dan arduino
silakan kopy code di bawah dan masukkan ke arduino
Baca membuat jam digital dengan led matrix
/*--------------------------------------------------------------------------------------
dmd_test.cpp
Demo and example project for the Freetronics DMD, a 512 LED matrix display
panel arranged in a 32 x 16 layout.
Copyright (C) 2011 Marc Alexander (info <at> freetronics <dot> com)
See http://www.freetronics.com/dmd for resources and a getting started guide.
Note that the DMD library uses the SPI port for the fastest, low overhead writing to the
display. Keep an eye on conflicts if there are any other devices running from the same
SPI port, and that the chip select on those devices is correctly set to be inactive
when the DMD is being written to.
USAGE NOTES
-----------
- Place the DMD library folder into the "arduino/libraries/" folder of your Arduino installation.
- Get the TimerOne library from here: http://code.google.com/p/arduino-timerone/downloads/list
or download the local copy from the DMD library page (which may be older but was used for this creation)
and place the TimerOne library folder into the "arduino/libraries/" folder of your Arduino installation.
- Restart the IDE.
- In the Arduino IDE, you can open File > Examples > DMD > dmd_demo, or dmd_clock_readout, and get it
running straight away!
* The DMD comes with a pre-made data cable and DMDCON connector board so you can plug-and-play straight
into any regular size Arduino Board (Uno, Freetronics Eleven, EtherTen, USBDroid, etc)
* Please note that the Mega boards have SPI on different pins, so this library does not currently support
the DMDCON connector board for direct connection to Mega's, please jumper the DMDCON pins to the
matching SPI pins on the other header on the Mega boards.
This example code is in the public domain.
The DMD library is open source (GPL), for more see DMD.cpp and DMD.h
--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------
Includes
--------------------------------------------------------------------------------------*/
#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"
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
#define DISPLAYS_BPP 1
#define WHITE 0xFF
#define BLACK 0
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN, DISPLAYS_BPP);
/*--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
/*--------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------*/
void setup(void)
{
//initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
Timer1.initialize( 5000/DISPLAYS_BPP ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()
//clear/init the DMD pixels held in RAM
dmd.clearScreen( BLACK ); //true is normal (all pixels off), false is negative (all pixels on)
}
/*--------------------------------------------------------------------------------------
loop
Arduino architecture main 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( BLACK );
dmd.selectFont(Arial_Black_16);
dmd.drawChar( 0, 3, '2', WHITE,BLACK );
dmd.drawChar( 7, 3, '3', WHITE,BLACK );
dmd.drawChar( 17, 3, '4', WHITE,BLACK );
dmd.drawChar( 25, 3, '5', WHITE,BLACK );
dmd.drawChar( 15, 3, ':', WHITE,BLACK ); // clock colon overlay on
delay( 1000 );
dmd.drawChar( 15, 3, ':', BLACK,BLACK ); // clock colon overlay off
delay( 1000 );
dmd.drawChar( 15, 3, ':', WHITE,BLACK ); // clock colon overlay on
delay( 1000 );
dmd.drawChar( 15, 3, ':', BLACK,BLACK ); // clock colon overlay off
delay( 1000 );
dmd.drawChar( 15, 3, ':', WHITE,BLACK ); // clock colon overlay on
delay( 1000 );
dmd.drawMarquee("ASSALAMUALAIKUM",15,(32*DISPLAYS_ACROSS)-1,0,WHITE,BLACK);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret){
if ((timer+30) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}
}
// half the pixels on
dmd.drawTestPattern( PATTERN_ALT_0 );
delay( 1000 );
// the other half on
dmd.drawTestPattern( PATTERN_ALT_1 );
delay( 1000 );
// display some text
dmd.clearScreen( BLACK );
dmd.selectFont(System5x7);
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
for (byte y=0;y<DISPLAYS_DOWN;y++) {
dmd.drawString( 2+(32*x), 1+(16*y), "freet", 5, WHITE,BLACK );
dmd.drawString( 2+(32*x), 9+(16*y), "ronic", 5, WHITE,BLACK );
}
}
delay( 2000 );
// draw a border rectangle around the outside of the display
dmd.clearScreen( BLACK );
dmd.drawBox( 0, 0, (32*DISPLAYS_ACROSS)-1, (16*DISPLAYS_DOWN)-1, WHITE );
delay( 1000 );
for (byte y=0;y<DISPLAYS_DOWN;y++) {
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
// draw an X
int ix=32*x;
int iy=16*y;
dmd.drawLine( 0+ix, 0+iy, 11+ix, 15+iy, WHITE );
dmd.drawLine( 0+ix, 15+iy, 11+ix, 0+iy, WHITE );
delay( 1000 );
// draw a circle
dmd.drawCircle( 16+ix, 8+iy, 5, WHITE );
delay( 1000 );
// draw a filled box
dmd.drawFilledBox( 24+ix, 3+iy, 29+ix, 13+iy, WHITE );
delay( 1000 );
}
}
// stripe chaser
for( b = 0 ; b < 20 ; b++ )
{
dmd.drawTestPattern( (b&1)+PATTERN_STRIPE_0 );
delay( 200 );
}
delay( 200 );
}
dmd_test.cpp
Demo and example project for the Freetronics DMD, a 512 LED matrix display
panel arranged in a 32 x 16 layout.
Copyright (C) 2011 Marc Alexander (info <at> freetronics <dot> com)
See http://www.freetronics.com/dmd for resources and a getting started guide.
Note that the DMD library uses the SPI port for the fastest, low overhead writing to the
display. Keep an eye on conflicts if there are any other devices running from the same
SPI port, and that the chip select on those devices is correctly set to be inactive
when the DMD is being written to.
USAGE NOTES
-----------
- Place the DMD library folder into the "arduino/libraries/" folder of your Arduino installation.
- Get the TimerOne library from here: http://code.google.com/p/arduino-timerone/downloads/list
or download the local copy from the DMD library page (which may be older but was used for this creation)
and place the TimerOne library folder into the "arduino/libraries/" folder of your Arduino installation.
- Restart the IDE.
- In the Arduino IDE, you can open File > Examples > DMD > dmd_demo, or dmd_clock_readout, and get it
running straight away!
* The DMD comes with a pre-made data cable and DMDCON connector board so you can plug-and-play straight
into any regular size Arduino Board (Uno, Freetronics Eleven, EtherTen, USBDroid, etc)
* Please note that the Mega boards have SPI on different pins, so this library does not currently support
the DMDCON connector board for direct connection to Mega's, please jumper the DMDCON pins to the
matching SPI pins on the other header on the Mega boards.
This example code is in the public domain.
The DMD library is open source (GPL), for more see DMD.cpp and DMD.h
--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------
Includes
--------------------------------------------------------------------------------------*/
#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"
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
#define DISPLAYS_BPP 1
#define WHITE 0xFF
#define BLACK 0
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN, DISPLAYS_BPP);
/*--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
/*--------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------*/
void setup(void)
{
//initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
Timer1.initialize( 5000/DISPLAYS_BPP ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()
//clear/init the DMD pixels held in RAM
dmd.clearScreen( BLACK ); //true is normal (all pixels off), false is negative (all pixels on)
}
/*--------------------------------------------------------------------------------------
loop
Arduino architecture main 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( BLACK );
dmd.selectFont(Arial_Black_16);
dmd.drawChar( 0, 3, '2', WHITE,BLACK );
dmd.drawChar( 7, 3, '3', WHITE,BLACK );
dmd.drawChar( 17, 3, '4', WHITE,BLACK );
dmd.drawChar( 25, 3, '5', WHITE,BLACK );
dmd.drawChar( 15, 3, ':', WHITE,BLACK ); // clock colon overlay on
delay( 1000 );
dmd.drawChar( 15, 3, ':', BLACK,BLACK ); // clock colon overlay off
delay( 1000 );
dmd.drawChar( 15, 3, ':', WHITE,BLACK ); // clock colon overlay on
delay( 1000 );
dmd.drawChar( 15, 3, ':', BLACK,BLACK ); // clock colon overlay off
delay( 1000 );
dmd.drawChar( 15, 3, ':', WHITE,BLACK ); // clock colon overlay on
delay( 1000 );
dmd.drawMarquee("ASSALAMUALAIKUM",15,(32*DISPLAYS_ACROSS)-1,0,WHITE,BLACK);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret){
if ((timer+30) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}
}
// half the pixels on
dmd.drawTestPattern( PATTERN_ALT_0 );
delay( 1000 );
// the other half on
dmd.drawTestPattern( PATTERN_ALT_1 );
delay( 1000 );
// display some text
dmd.clearScreen( BLACK );
dmd.selectFont(System5x7);
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
for (byte y=0;y<DISPLAYS_DOWN;y++) {
dmd.drawString( 2+(32*x), 1+(16*y), "freet", 5, WHITE,BLACK );
dmd.drawString( 2+(32*x), 9+(16*y), "ronic", 5, WHITE,BLACK );
}
}
delay( 2000 );
// draw a border rectangle around the outside of the display
dmd.clearScreen( BLACK );
dmd.drawBox( 0, 0, (32*DISPLAYS_ACROSS)-1, (16*DISPLAYS_DOWN)-1, WHITE );
delay( 1000 );
for (byte y=0;y<DISPLAYS_DOWN;y++) {
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
// draw an X
int ix=32*x;
int iy=16*y;
dmd.drawLine( 0+ix, 0+iy, 11+ix, 15+iy, WHITE );
dmd.drawLine( 0+ix, 15+iy, 11+ix, 0+iy, WHITE );
delay( 1000 );
// draw a circle
dmd.drawCircle( 16+ix, 8+iy, 5, WHITE );
delay( 1000 );
// draw a filled box
dmd.drawFilledBox( 24+ix, 3+iy, 29+ix, 13+iy, WHITE );
delay( 1000 );
}
}
// stripe chaser
for( b = 0 ; b < 20 ; b++ )
{
dmd.drawTestPattern( (b&1)+PATTERN_STRIPE_0 );
delay( 200 );
}
delay( 200 );
}
Perhatian:
- Teliti dan amati di dalam file hex nya jika ada yang kurang dalam meng copy kode maka saat di kompling tidak akan berjalan
- jika terjadi eror maka akan ada tulisan berwarna kuning dan kalian harus menganti atau mengeditnya,hehe sambil belajar yA
- ganti tulisan ASSALAMUALAIKUM warna merah dengan selera kalian
Baca cara merakit arduino dengan panel led matrix p10
Membuat jam digital di sertai lampu tidur
Terimakasih telah berkunjung ke blog ini semoga sedikit membantu bagi kalian yang lagi belajar arduino
yang penting tetep belajarya ,,semagat..
Sama sama mas smally
ReplyDeletekok masih ada eror di DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN, DISPLAYS_BPP); ya?
ReplyDeletePencerahannya
klo boleh tau.agan pake arduino apa dan bagaimana cara me masukkan file ke arduino nya
DeleteEmang harus pakek arduino id versi berapa bang.
Deleteyang terbaru bisa mas sama aja ko
Deletebeli DMD converter dimana ya gan udah muter" gak ketemu,
ReplyDelete#daerahbandung
buat sendiri aja mas dwi
Deletemf mas...dmd saya k ada yg eror z....saya pake arduino id 0022
ReplyDeletedownload master dmd dulu mas lalu masukkan ke folder arduino
Deletesetelah itu di coba lagi mas
mas bisa minta tolong untuk pembuatan monitor rpm kecepatan motor dc trus ditampilkan ke led matrix p10 itu bisa gak yaa?? mohon pencerahanya
ReplyDeletemas bagaimana cara agar text berjalan(drawMarquee)perulangan nya
ReplyDeletehanya 1 kali saja?
Mas klau buat ukuran 64x32 bsa nggak ya?
ReplyDelete