LiquidCrystal library output to values?

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.

Thanks in advance for the help

Karl

please modify your ppost , select the code and press the # button, looks better that way

You need to assign a value to the 6 variables, now they will be undefined (probably zero).

#include <LiquidCrystal.h>

int lcd12 = 12;
int lcd11 = 11;
int lcd5 = 5;
int lcd4 = 4;
int lcd3 = 3;
int lcd2 = 2;

void setup()
{
  LiquidCrystal lcd(lcd12, lcd11, lcd5, lcd4, lcd3, lcd2);
  lcd.print("Hello World!");
}

void loop(){
}

Standard lcd library doesn't support shift registers.

Maybe this one can get you started:

http://www.arduino.cc/playground/Code/LCD3wires

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.

Karl

robtillaart:
please modify your ppost , select the code and press the # button, looks better that way

You need to assign a value to the 6 variables, now they will be undefined (probably zero).

Thanks. Have changed my OP.

I tried with and without variables. Neither seems to work.

I tried shifting out these earlier today.

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.

You need to show more of your code. All you were saying about shift registers need to be shown with code.

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