Running Text untuk Mobil atau Motor ( Nano + Max 7219 )
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 7
#define DATA_PIN 6
#define CS_PIN 8
#define kiri 3
#define kanan 4
#define rem 5
// HARDWARE SPI
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
int i = 0;
int j=0;
int k=0;
void panah_kiri();
void panah_kanan();
void Stop_blink();
void Rem_blink();
textEffect_t texteffect[] =
{
PA_PRINT,
PA_SCAN_HORIZ,
PA_SCROLL_LEFT,
PA_WIPE,
PA_SCROLL_UP_LEFT,
PA_SCROLL_UP,
PA_OPENING_CURSOR,
PA_GROW_UP,
PA_MESH,
PA_SCROLL_UP_RIGHT,
PA_BLINDS,
PA_CLOSING,
PA_RANDOM,
PA_GROW_DOWN,
PA_SCAN_VERT,
PA_SCROLL_DOWN_LEFT,
PA_WIPE_CURSOR,
PA_DISSOLVE,
PA_OPENING,
PA_CLOSING_CURSOR,
PA_SCROLL_DOWN_RIGHT,
PA_SCROLL_RIGHT,
PA_SLICE,
PA_SCROLL_DOWN
};
void setup() {
pinMode(kiri, INPUT);
pinMode(kanan, INPUT);
pinMode(rem, INPUT);
myDisplay.begin();
myDisplay.setIntensity(5);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.setPause(1000);
myDisplay.setSpeed(20);
myDisplay.displayClear();
}
void loop() {
int tombolkiri=digitalRead(kiri);
int tombolkanan=digitalRead(kanan);
int tombolrem=digitalRead(rem);
if (tombolkiri==1 and tombolkanan==1)
{
Hati2_blink();
}
if (tombolkiri==1)
{
j++;
if(j==1)
{
// myDisplay.displayReset();
myDisplay.displayClear();
myDisplay.print(" ");
}
panah_kiri();
k=0;
}
else if (tombolkanan==1)
{
j++;
if(j==1)
{
myDisplay.displayClear();
myDisplay.print(" ");
}
panah_kanan();
k=0;
}
else if (tombolrem==1)
{
Stop_blink();
}
else
{
j=0;
k++;
if(k==1)
{
myDisplay.displayClear();
myDisplay.print(" ");
}
if ( k>10) {k=2;}
myDisplay.setIntensity(2);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.setPause(1);
myDisplay.setSpeed(30);
if (myDisplay.displayAnimate()) {
i=2;
myDisplay.displayText("Welcome to Youtube Channel Belajar Tehnologi jaman Now", myDisplay.getTextAlignment(), myDisplay.getSpeed(), myDisplay.getPause(), texteffect[i], texteffect[i]);
myDisplay.displayReset();
}
}
}
void panah_kiri()
{
myDisplay.setIntensity(5);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.setPause(0);
myDisplay.setSpeed(20);
if (myDisplay.displayAnimate()) {
i=2;
myDisplay.displayText("<<<< <<<< <<<< <<<<", myDisplay.getTextAlignment(), myDisplay.getSpeed(), myDisplay.getPause(), texteffect[i], texteffect[i]);
myDisplay.displayReset();
}
}
void panah_kanan()
{
myDisplay.setIntensity(5);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.setPause(0);
myDisplay.setSpeed(20);
if (myDisplay.displayAnimate()) {
i=21;
myDisplay.displayText(">>>> >>>> >>>> >>>>", myDisplay.getTextAlignment(), myDisplay.getSpeed(), myDisplay.getPause(), texteffect[i], texteffect[i]);
myDisplay.displayReset();
}
}
void Stop_blink()
{
myDisplay.print("<STOP>");
delay(200);
myDisplay.print(" ");
delay(200);
}
void Hati2_blink()
{
myDisplay.print("Hati2 ");
delay(200);
myDisplay.print(" ");
delay(200);
}
Mas izin copy data coding nya ya 😁🙏
ReplyDeleteok
DeleteBoleh Saya praktekan Gan..?
ReplyDeletesilahken
DeleteKalo di tambah wifi. Program nya apa yg ditambah mas
ReplyDeletemas kalau mau pakai P10 apanya yang dirubah dicodingnya
ReplyDeleteBisa saya minta kontaknya om
ReplyDelete