PID heater Control with simple SerLCD interface

Hey all... Hope you're all having a great day. I have a few questions for those who understand CPP with ease.

First let me explain the project. Last year I was toying with a arduino PID controlled heater and had that working pretty decently with the sample PID code from http://www.arduino.cc/playground/Code/PIDLibrary.

Now I have added: a sparkfun SerLCD screen as well as 2 pushbuttons.

Ideally...one button will be to increase the "Setpoint" by 1 degree and the other will lower it by 1 degree. I am trying to accomplish having the LCD(16x2 lines) readout the "Setpoint" on the first line and on the second line I am trying to get it to display the current temp or PV i believe..

Here is what I have so far:
/********************************************************

  • PID Simple Example
  • Reading analog input 0 to control analog PWM output 10
    ********************************************************/

#include <PID_Beta6.h>

//Define Variables we'll be connecting to
double Setpoint, Input, Output;

//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint, 2,5,1);

const int lcdPin = 1 // Serial com. to LCD
const int heatPin = 10; // PWM signal for the heater
const int onPin = 2; // choose the input pin to trigger heater via pushbutton
const int upPin = 6; // choose the input pin to increase temp
const int downPin = 7; // choose the input pin to decrease temp
int buttonState = 0; // variable for reading the pin status
unsigned long lastTime;
void setup()
{
Serial.begin( 19200 );
//initialize the variables we're linked to
Input = analogRead(0);
Setpoint = 200;

// Declare inputs
pinMode(onPin, INPUT); // declare pushbutton as input(heater trigger button)
pinMode(upPin, INPUT); // declare pushbutton as input (increase temp by 1)
pinMode(downPin, INPUT); // declare pushbutton as input(decrease temp by 1)
pinMode(heatPin, OUTPUT); // declare pushbutton as output (signal to power heater)
pinmode(lcdPin, OUTPUT); // declare serial LCD output
//turn the PID on
myPID.SetMode(MANUAL);
Output=0;
myPID.SetSampleTime(250);
myPID.SetTunings(2,3,1);
myPID.SetOutputLimits(0, 220);
lastTime = millis();
}

void loop()
{
buttonState = digitalRead(onPin);

if (buttonState == HIGH) {
// turn LED/HEATER on:
digitalWrite(heatPin, HIGH);
myPID.SetMode(AUTO);
}
else {
// turn LED/HEATER off:
digitalWrite(heatPin, LOW);
myPID.SetMode(MANUAL);
Output=0;
}
unsigned long lastTime;
if(digitalRead(upPin)==HIGH)
{
if (millis()-lastTime >= 250) {
Setpoint+=1;
lastTime=millis();
}
}

if(digitalRead(downPin)==HIGH)
{
if (millis()-lastTime >= 250) {
Setpoint-=1;
lastTime=millis();
}
}
Input = analogRead(0);
myPID.Compute();
analogWrite(10,Output);
}


Now.... a couple things... I am running the PID @ 19200 baud rate. I know that the SerLCD has a default of 9600. So... Is the following code sort of correct to adjust the baud rate of the LCD to 19200? AND... where should I put this code?

Serial.print(0x7C, BYTE); //character 124 wich tells the lcd it's about to get configed
Serial.print( 0x09, BYTE); // splash screen reset - when you have the usb and tx and vc plugged in you get a conflict that is why you need this code
delay(500);
Serial.print(0x0F, BYTE); //19200 bps baud rate config command?

So I am stuck on how to send the setpoint to the first line and the PV to the second line.

Lastly... The new arduino software seems to not be liking the sample PID scripts... When I just load the sample script unmodified like it is when you download it and try and have the program compile or "test" it I get the following error:
"
PIDSample.cpp:6:23: error: PID_Beta6.h: No such file or directory
PIDSample:11: error: 'PID' does not name a type
PIDSample.cpp: In function 'void setup()':
PIDSample:20: error: 'myPID' was not declared in this scope
PIDSample:20: error: 'AUTO' was not declared in this scope
PIDSample.cpp: In function 'void loop()':
PIDSample:26: error: 'myPID' was not declared in this scope
"

I never used to get that with the old software... version 15 i believe... now I have 21..

Any ideas? Thank you so much!

I believe that the location of user add-on files (libraries) has actually moved between version 15 and version 18. This might be part of your issue.

Well.... i've copied the files to every single location that I could find associated with arduino and it still gives me that error..

Should I just download the old version?

Ok so I fixed the directory issue...

I needed to create a folder within the arduino folder called libraries and work from within there.

I got a few tips via msg that I sort of understand.. does this make sense? :

"According to the datasheet, you have the right escape character 0x7C, but after that the datasheet says you should "enter o". This is confused. I think what they were trying to say is: 1. After the 0x7C byte, you should transmit some specific second byte, with some unstated value which I shall hereafter call X; and 2. On some unstated computer system, the keyboard combination -O maps to a keycode with value X. They were probably thinking about PCs running either DOS or Windows. On my Linux box, control-O seems to map to 0xf, as found by doing: cat | od -x and hitting control o followed by enter followed by control-d. Question: why can't you just leave the LCD at 9600 baud? Are you aware that you can talk at 9600 baud on one serial port, and at 19200 baud on a second serial port, simultaneously? I don't think you can roll two commands into one scape sequence, as you seem to be attempting to do. It looks to me like the splash-screen reset command, and the baud rate control command, should each be sent separately, each with its own escape byte(s) preceding. I hope this helps at least a little."


What I am wondering is how and where I should put the escape byte and how to do the two different baud rates on the serial ports like he's talking about.