Is it possible to have the LiquidCrystal library output switch int values between high and low?
I'm trying to expand my outputs by using cascading shift registers to run both the lcd display and switch outputs.
example:
#include <LiquidCrystal.h>
int lcd12;
int lcd11;
int lcd5;
int lcd4;
int lcd3;
int lcd2;
void setup(){
LiquidCrystal lcd(lcd12, lcd11, lcd5, lcd4, lcd3, lcd2);
lcd.print("Hello World!");
}
void loop(){
}
I can't seem to get this to work, but maybe there's a way to run the display and outputs on 3 digital pins that I haven't thought of.
I do have the lcd display working with a shift register, but I'm looking for a way to use the same 3 Arduino outputs to cascade shift registers and handle all the other outputs for this project.
It doesn't seem that the LiquidCrystal library will write to values.
I used the Serial.print function to show me the contents of the array I was shifting out. All the values just stayed at zero.
Ask and receive. Sorry, would've posted it earlier, but was a little dense.
It's the classic Hello World sketch with some additions.
// include the library code:
#include <LiquidCrystal.h>
byte lcd12 = 0;
byte lcd11 = 0;
byte lcd5 = 0;
byte lcd4 = 0;
byte lcd3 = 0;
byte lcd2 = 0;
byte filler = 0;
// int ops[] = {lcd12, lcd11, lcd5, lcd4, lcd3, lcd2, filler, filler};
int outputs = 0;
//Pin connected to ST_CP of 74HC595
int latchPin = 7;
//Pin connected to SH_CP of 74HC595
int clockPin = 6;
////Pin connected to DS of 74HC595
int dataPin = 8;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(lcd12, lcd11, lcd5, lcd4, lcd3, lcd2);
void setup() {
Serial.begin(9600);
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
outputs = 0;
// 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);
int ops[] = {lcd12, lcd11, lcd5, lcd4, lcd3, lcd2, filler, filler};
for (int i = 0; i < 8; i ++){
outputs += ops[i];
outputs *= 2;
}
Serial.println(outputs); // debug info
digitalWrite(latchPin, LOW);
// shift out the bits:
shiftOut(dataPin, clockPin, MSBFIRST, outputs);
//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
}