It looks like an extremely primitive library. It doesn't inherit the print() method from the Stream class, so you can't use it like most other displays which leverage the print() function to print all types of variables. This can only write strings and it doesn't even check if the string is longer than the display.
To make a scrolling message, you want to send it strings like "It's Working" and "t's Working" and so on. One way to do that would be to write out all of those strings in your code. Another way is to do a little pointer arithmetic so that instead of sending it the pointer to the beginning of the string, you give it a pointer to the second character of the string.
#include "vfd_vaf1613.h"
//adjust these according to your wiring:
const byte clockPin = 8;
const byte dataPin = 9;
const byte resetPin = 10;
VFD_VAF1613 vfd(clockPin, dataPin, resetPin);
char myString[] = {"It's Working "}; //must have a blank space at the end.
unsigned long scrollInterval = 200; //milliseconds, use a smaller number to scroll faster
void setup()
{
vfd.init();
vfd.power_on();
vfd.write("HELLO");
delay(5000);
vfd.short_reset();
delay(500);
}
void loop()
{
static byte scrollStartPosition = 0;
static unsigned long lastScrollStep;
if(millis() - lastScrollStep > scrollInterval) {
vfd.write(myString + scrollStartPosition);
scrollStartPosition++;
if(scrollStartPosition > strlen(myString)) {
scrollStartPosition = 0;
}
lastScrollStep = millis();
}
//other code here
}
Arduino: 1.8.6 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\gareth\OneDrive\Desktop\vfd_vaf1613-master\new\sketch_oct30b\sketch_oct30b.ino: In function 'void setup()':
C:\Users\gareth\OneDrive\Desktop\vfd_vaf1613-master\new\sketch_oct30b\sketch_oct30b.ino:17:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
vfd.write("HELLO");
^
C:\Users\gareth\OneDrive\Desktop\vfd_vaf1613-master\new\sketch_oct30b\sketch_oct30b.ino: In function 'void loop()':
sketch_oct30b:30:47: error: expected ')' before '{' token
if(scrollStartPosition > strlen(myString) {
^
sketch\vfd_vaf1613.cpp: In member function 'void VFD_VAF1613::long_reset()':
sketch\vfd_vaf1613.cpp:53:15: warning: large integer implicitly truncated to unsigned type [-Woverflow]
reset(2000);
^
exit status 1
expected ')' before '{' token
Sorry it's probably a really basic fix and after a little google i still didn't solve it.
After you run vfd.short_reset(); i've found you must always use vfd.power_on(); for the screen to display. so i added that to the front of the loop and it's working great.
Next i'm going to buy an RTC and see if i can get that to display on the screen.
This screen was free and it's already becoming an addictive project haha.