Tulisan Berjalan DG Dot Matrix
Tulisan Berjalan DG Dot Matrix
Tulisan Berjalan DG Dot Matrix
com]
Kebutuhan Hardware :
Arduino UNO Board
Modul LED Dot Matrix ukuran 32x8 dengan driver MAX7219
Power Supply 7-9 Vdc
Schematics
2 Inkubatek [supported by : www.tokotronik.com]
5V VCC
GND GND
13 CLK
11 DIN
10 CS
INKUBATEK
INKUBATEK
3 Inkubatek [supported by : www.tokotronik.com]
Source Code/Sketch :
/*************************************
* Program : Project 125. Tulisan Berjalan dg Dot Matrix
* 125 Proyek Arduino Inkubatek
* www.inkubator-teknologi.com
* www.tokotronik.com
* ***********************************/
#include <MD_MAX72xx.h>
#include <SPI.h>
//#include <MD_KeySwitch.h>
#define MAX_DEVICES 4
#define CLK_PIN 13 // or SCK
#define DATA_PIN 11 // or MOSI
#define CS_PIN 10 // or SS
//==============================
bool scrollText(bool bInit, char *pmsg)
// Callback function for data that is required for scrolling into the display
{
static char curMessage[BUF_SIZE];
static char *p = curMessage;
4 Inkubatek [supported by : www.tokotronik.com]
// are we initializing?
if (bInit)
{
resetMatrix();
strcpy(curMessage, pmsg);
state = 0;
p = curMessage;
bInit = false;
}
mx.setColumn(0, colData);
if (curLen == showLen)
{
showLen = ((*p != '\0') ? CHAR_SPACING : mx.getColumnCount()-1);
curLen = 0;
state = 2;
}
break;
case 2: // display inter-character spacing (blank column) or scroll off the display
mx.setColumn(0, 0);
if (++curLen == showLen)
{
state = 0;
bInit = (*p == '\0');
}
break;
default:
state = 0;
}
return(bInit);
}
//=================================
void setup()
{
mx.begin();
}
//==================================
void loop()
{
bRestart = scrollText(bRestart, "99 Proyek ARDUINO ...");
6 Inkubatek [supported by : www.tokotronik.com]
//==================================
void resetMatrix(void)
{
mx.control(MD_MAX72XX::INTENSITY, MAX_INTENSITY/2);
mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::ON);
mx.clear();
prevTimeAnim = 0;
}
Jalannya Alat :
Pada modul LED Dot Matrix 32x8 akan tampil tulisan berjalan ke arahkiri “99 Proyek ARDUINO...”.
Jika akan mengganti tulisan yang berjalan, cukup ganti string yang ada di program
void loop()
{
bRestart = scrollText(bRestart, "99 Proyek ARDUINO ...");
}
7 Inkubatek [supported by : www.tokotronik.com]