My First VFD

Hi all,

So i'm still very new to arduino but i've managed to get my first VFD to display with the help from the following places:

Arduino library for driving a VAF1613 vacuum flourescent display - GitHub - derpston/vfd_vaf1613: Arduino library for driving a VAF1613 vacuum flourescent display

https://forum.arduino.cc/index.php?topic=513312.0

Here is what i have so far -

#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);

void setup() 
{
  vfd.init();
  vfd.power_on();
  vfd.write("HELLO");
  delay(5000);
  vfd.short_reset();
  delay(500);
}

void loop() 
{
  vfd.power_on();
  vfd.write("IT'S WORKING");
  delay(5000);
  vfd.short_reset();
  delay(500);
  vfd.power_on();
  vfd.write("YAY");
  delay(5000);
}

It displays three messages with no trouble.

How would i make a message scroll along the screen?

I would also like to add the time & date.

:slight_smile:

It looks like the same library in both links.

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
}

Edit: fixed missing )

hello MorganS

Thank you very much for getting back to me.

Ah it's a shame it's so basic, i've seen some other people do some cool stuff like - VFD Futaba M202SD16A display with Arduino - YouTube

they appear to use LiquidCrystal.h.

When i try to compile that script i get -

exit status 1
expected ')' before '{' token

full log

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.

error.png

Try

vfd.write((char *)"Some string");

Sorry, I missed a )

I didn't compile it because I don't have that library.

if(scrollStartPosition > strlen(myString)) {

Ah yeah i see it now.

Here is the result -

It's working thank you very much :smiley:

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.