Go Down

Topic: brightness control for Noritake LCD-compatible VFD (Read 5207 times) previous topic - next topic

quarterturn

Here's a suggestion for an addition to the LiquidCrystal library:

LiquidCrystal.cpp diff:
Code: [Select]

255,270d254
< // set dimming on Noritake LCD-compatible VFD
< // dimming levels:
< // 0 = 100%
< // 1 = 75%
< // 2 = 50%
< // 3 = 25%
< void LiquidCrystal::vfdDim(uint8_t dimming) {
<       if ((dimming > -1) && (dimming < 4)) {
<             digitalWrite(_rw_pin, LOW);
<             send(0x28, LOW);
<             digitalWrite(_rw_pin, HIGH);
<             send(dimming, HIGH);
<             digitalWrite(_rw_pin, LOW);
<       }
< }
<


LiquidCrystal.h diff:
Code: [Select]

79d78
<   void vfdDim(uint8_t dimming);


Usage example code - alternates between 100% and 25% brightness  every second:
Code: [Select]

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
 // set up the LCD's number of columns and rows:
 lcd.begin(20, 2);
 // Print a message to the LCD.
 lcd.vfdDim(3);
 lcd.print("hello, world!");
}

void loop() {
 // set the cursor to column 0, line 1
 // (note: line 1 is the second row, since counting begins with 0):
 lcd.setCursor(0, 1);
 // print the number of seconds since reset:
 lcd.print(millis()/1000);
 if (((millis()/1000) % 2) == 0)
 {
   lcd.vfdDim(0);
 }
 else
 {
   lcd.vfdDim(3);
 }
}


Tested on a Noritake CU20029ECPB-W1J

VFDs rock!  :)

Justin Opotzner

I have found this code useful, thank you!

Tested on a CU20025ECPB-W1J as working.

Go Up