Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <DMD.h>
- #include <TimerOne.h>
- #include "SystemFont5x7.h"
- #include "Arial_black_16.h"
- //Fire up the DMD library as dmd
- #define DISPLAYS_ACROSS 3
- #define DISPLAYS_DOWN 1
- DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
- void ScanDMD()
- {
- dmd.scanDisplayBySPI();
- }
- void setup(void)
- {
- Timer1.initialize( 5000 );
- Timer1.attachInterrupt( ScanDMD );
- dmd.clearScreen( true );
- Serial.begin(9600);
- }
- void loop(void)
- {
- dmd.clearScreen( true );
- // dmd.selectFont(Arial_Black_16);
- dmd.selectFont(System5x7);
- char teks[] = "Scrolling Text";
- int lebarTeks = 0;
- for (int i = 0; i < sizeof(teks)+1; i++) {
- lebarTeks += dmd.charWidth(teks[i]) + 1;
- }
- dmd.drawBox( 0, 0, (32*DISPLAYS_ACROSS)-1, (16*DISPLAYS_DOWN)-1, GRAPHICS_NORMAL );
- int i = 0;
- while(true) {
- dmd.drawString ((lebarTeks+10)-i, 3, teks, sizeof(teks), GRAPHICS_NORMAL);
- dmd.drawBox( 0, 0, (32*DISPLAYS_ACROSS)-1, (16*DISPLAYS_DOWN)-1, GRAPHICS_NORMAL );
- Serial.println(i);
- delay(100);
- if(i >= 180) {
- i = 0;
- }
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement