hello friend.
I am using arduino uno, i want to make bus display there are two text, bus number and destination number, for example : 1A| TEXAS - CHICAGO and this is the rule:
number bus is stay text and destination bus is left scroll, how can i devide two text,
#include <SPI.h>
#include <DMD2.h>
#include <fonts/SystemFont5x7.h>
#include <Arial_black_16.h>
#include <EEPROM.h>
#include "Arduino.h"
char rChar;
const int WIDTH = 2;
const uint8_t *FONT = Arial_Black_16;
int panjang;
SoftDMD dmd(2, 1);
SoftDMD dmd1(2, 1);
DMD_TextBox box(dmd1, 0, 1);
String command;
String readString;
int i;
int counting = 1;
#define maxChar 500
char runningText[maxChar];
byte index;
void ep() {
if (Serial.available() > 0 ) {
for (i = 0; i < 499; i++) {
EEPROM.write(i, 0);
}
}
while (Serial.available() > 0) {
if (index < (maxChar - 1)) {
rChar = Serial.read();
runningText[index] = rChar;
EEPROM.write(index, runningText[index]);
index++;
runningText[index] = '\0';
}
}
}
void setup() {
Serial.begin(9800);
dmd.setBrightness(500);
dmd.selectFont(FONT);
dmd.begin();
for (i = 0; i < 499; i++) {
runningText[i] = EEPROM.read(i);
}
}
void des () {
String varA = runningText;
String tug = varA.substring(0, strlen);
const char* hub = tug.c_str();
char* cim = strtok(hub, "|");
dmd1.selectFont(FONT);
String sep = "|";
String a = cim + sep;
a.trim();
panjang = a.length() * 8 - 1;
(panjang);
dmd.begin();
dmd.drawString(0, 1, a );
}
void loop(void) {
des();
xscr();
}
void xscr() {
String varA = runningText;
String tax = varA.substring(0, strlen);
const char* mg = tax.c_str();
String tx = strtok(mg, "|"); // seperated or delimiter from |
String v = "|";
String scr = tx + v;
const char* mk = scr.c_str();
char* sctext = strtok(NULL, "|");// delimiter after |
String myString = String(sctext);
myString.trim();
DMD_TextBox box1(dmd, panjang, 1);
const char *next = sctext;
while (*next) {
Serial.print(*next);
box1.print(*next);
delay(200);
next++;
}
box.clear();
}
i writing text using serial port, but there is problem scroll text not running smoothly..
any idea guys..plz help me