Here is a copy of my code I'm using now with the Alphanumeric LCD, which I would like to use with the Vizio Smart-GPU display.
Thank you for all your input....!!!!
// include the library code:
#include <LiquidCrystal.h>
#include <PID_v1.h>
#define aref_voltage 1.72
#define PPO inputReading1*aref_voltage/1024
double Setpoint, Input, Output; //Define Variables we'll be connecting to
PID myPID(&Input, &Output, &Setpoint, 5,7,2, REVERSE); //Specify the links and initial tuning parameters
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the lcd with the numbers of the interface pins
/****************************************************************
*initiate pins for each led
*****************************************************************/
const int red1 =22;
const int blue1 =28;
const int green1 =26;
const int yellow1 =0;
int nr; // declare numbers of flashes
/****************************************************************/
/****************************************************************
*initiate pins for sensor inputs 1, 2, 3
*****************************************************************/
const int sensor1 = A0; // the analog pin the 02 Sensor Vout pin is connected to
int inputReading1; //declare a variable
const int sensor2 = A1; // the analog pin the 02 Sensor Vout pin is connected to
int inputReading2; // declare a variable
const int sensor3 = A2; // the analog pin the 02 sensor Vout pin is connected to
int inputReading3; // declare a variable
/*****************************************************************/
void setup ()
{
Input = analogRead(PPO);
Setpoint = 520;
myPID.SetMode(AUTOMATIC);
analogReference(EXTERNAL); // set external analog Ref for PPO output
/*****************************************************************
*set output assignments for led pins
******************************************************************/
pinMode( red1, OUTPUT);
pinMode( green1, OUTPUT);
pinMode( blue1, OUTPUT);
/****************************************************************/
/***************************************************************
*set up the LCD's number of columns and rows:
****************************************************************/
lcd.begin(20, 4);
lcd.setCursor(0, 0);//where to start cursor
lcd.print("PINA SYSYTEMS ");//print message
lcd.print("SOFTWARE VERSION 1.0");//print message
delay(2000);
lcd.clear();
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("PP1"); // Print a message to the LCD.
lcd.setCursor(6, 0); // set the cursor to column 6, line 0
lcd.print("PP2"); // Print a message to the LCD
lcd.setCursor(12, 0); // set the cursor to column 12, line 0
lcd.print("PP3"); // Print a message to the LCD.
}
/*************************************************************/
/**************************************************************
*setup all three RGB colrs for each range of PPO
***************************************************************/
void blinkGreen1(int nr) // number of blinks follwed by a delay
{
for(int i=0; i< nr; i++)
if( PPO <= .50)
{
digitalWrite(green1,LOW);
delay(250);
digitalWrite(green1, HIGH);
delay(250);
}
else digitalWrite(green1, HIGH);
}
void blinkBlue1(int nr) // number of blinks follwed by a delay
{
for(int i=0; i< nr; i++)
if( PPO > .50 && PPO < 1.00)
{
digitalWrite(blue1,LOW);
delay(250);
digitalWrite(blue1, HIGH);
delay(250);
}
else digitalWrite(blue1, HIGH);
}
void blinkRed1(int nr) // number of blinks follwed by a delay
{
for(int i=0; i< nr; i++)
if(PPO >1.00)
{
digitalWrite(red1,LOW);
delay(250);
digitalWrite(red1, HIGH);
delay(250);
}
else digitalWrite(red1, HIGH);
}
/**********************************************************************/
void loop ()
{
blinkGreen1((int)(PPO*10)); // flash green
blinkBlue1((int)(PPO*10)); // flash blue
blinkRed1((int)(PPO*10)); // flash red
/**********************************************************************
* turn the output pin on/off based on pid output
***********************************************************************/
Input = analogRead(PPO); // PID analog input for PPO
myPID.Compute(); // computing the out for setpoint control
analogWrite(7,Output); // the output to fire O2 solenoid
/**********************************************************************/
/*************************************************************
* initialize LCD and display PPO readings
**************************************************************/
lcd.setCursor(0, 1); //sets the cursor to column 0, line 1
inputReading1 = analogRead(sensor1); //getting the voltage reading from the 02 sensor
float voltage1 = inputReading1 * aref_voltage; // converting that reading to voltage
voltage1 /= 1024.0;
lcd.print(voltage1, 2);//print actual voltage to lcd
delay(200);
lcd.setCursor(6, 1); //sets the cursor to column 6, line 1
inputReading2 = analogRead(sensor2); //getting the voltage reading from the temperature sensor
float voltage2 = inputReading2 * aref_voltage; // converting that reading to voltage
voltage2 /= 1024.0;
lcd.print(voltage2, 2); //print actual voltage to lcd
delay(200);
lcd.setCursor(12, 1); //sets the cursor to column 12, line 2
inputReading3 = analogRead(sensor3); //getting the voltage reading from the temperature sensor
float voltage3 = inputReading3 * aref_voltage; // converting that reading to voltage
voltage3 /= 1024.0;
lcd.print(voltage3, 2); //print actual voltage to lcd
delay(200);
}