Quick LCD help.  Small directory or code error.

Hey all I have the following code to play with my arduino on

and I get the following error when I try and compile it. or “test run” the code.

"27: error: LiquidCrystal.h: No such file or directory In function ‘void setup()’:
In function ‘void loop()’:
"

Anyone know where I could be screwing up? I am using arduino 15 and am pretty sure I have the “LiquidCrystal.h” file in all the directories.

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

#include <LiquidCrystal.h>
#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);

// we should connect LCD like on the page
//http://arduino.cc/en/Tutorial/LiquidCrystalBlink
//only instead pin 5 (which is already in use
//we would use pin 8 instead
//so we would engage pins 12, 11, 8, 4, 3, 2
// so, input pin better to redefine
LiquidCrystal lcd(12, 11, 8, 4, 3, 2);

const int onPin = 5; // choose the input pin to trigger heater
//leave them the same
const int upPin = 7;   // choose the input pin to increase temp
const int downPin = 6;   // choose the input pin to decrease temp
int buttonState = 0;     // variable for reading the pin status
//also we would need pre-states of Up and Down button
//because person is slower then processor.
// and when I push button, loop would cycle several times
// then value would encerase for more then 1
int DownPushed = 0;
int UpPushed = 0;
int OnPushed = 0;
int PID_ON = 0;
int UpdScr = 0;
int inpt;
double ALPHA;


unsigned long lastTime, lShowTime; 

void setup()
{
  Serial.begin( 19200 );
  //initialize the variables we're linked to
  Input = analogRead(0);
    Setpoint = 100;
    
    
  // Declare inputs
  pinMode(onPin, INPUT);    // declare pushbutton as input
  pinMode(upPin, INPUT);    // declare pushbutton as input
  pinMode(downPin, INPUT);    // declare pushbutton as input
 
  //turn the PID on STANDBY
  myPID.SetMode(MANUAL);
  Output=0;
  myPID.SetSampleTime(250);
  myPID.SetTunings(2,3,1);
  myPID.SetOutputLimits(0, 220);
  lShowTime = lastTime = millis();
  ALPHA = 0.8;

      // set up the LCD's number of columns and rows:
      lcd.begin(16,2);
}

void loop()
{
      buttonState = digitalRead(onPin);
//reverting back

      if (buttonState == HIGH) {
            // turn HEATER on:
            myPID.SetMode(AUTO);
            PID_ON =1;
      }
      else {
                 myPID.SetMode(MANUAL);
            Output = 0;
            PID_ON =0;
      }

/*
      // here I'm changing the behaviour
      // previously it worked only while you push the on button
      // now it would be switch on/off button
      // you push it once - switch on
      // push second time - switch off
      if (buttonState == HIGH) {
            // turn HEATER on:
            if( OnPushed ==0 && PID_ON == 0 ) {
                  myPID.SetMode(AUTO);
                  OnPushed = 1;
                  PID_ON =1;
            }
            if( OnPushed ==0 && PID_ON == 1) {
                      // turn HEATER off:
                       myPID.SetMode(MANUAL);
                  Output=0;
                  OnPushed = 1;
                  PID_ON = 0;
            }
      }
      else {
            OnPushed= 0; // button is not pushed. may be it was released
      }
*/

      // I would not change these lines, because you are expecting 250 ms for a "push"
      // that is if you hold button for more then 1/4 second, 
      if(digitalRead(upPin)==HIGH) {
            if (millis()-lastTime >= 250) {
                  Setpoint+=1;
                  lastTime=millis();
                  UpdScr = 1;
            }
      }

      if(digitalRead(downPin)==HIGH) {
            if (millis()-lastTime >= 250) {
                  Setpoint-=1;
                  lastTime=millis();
                  UpdScr = 1;
            }
      }
      Input = analogRead(0);
      myPID.Compute();
      analogWrite(3,Output);
      //and output to LCD

      if( (millis() - lShowTime > 50 ) || UpdScr ) {
            UpdScr = 0;
            lcd.SetCursor(0,0);
      //if heater is on - show *
      //if not - empty
            if( PID_ON ==1 ) {
                  lcd.print("*");
            }
            else {
                  lcd.print(" ");
            };
            lcd.print("desired: ");
            lcd.print((int)(SetPoint) );
            lcd.SetCursor( 0,1);
            lcd.print(" Obtaind: ");
            inpt = (int)(inpt * ALPHA + (1.- ALPHA) * Input);
            lcd.print( inpt );
            lShowTime = millis();
      }
}

I am using arduino 15

The current version is 22. Why are you using 15?

Using Sketch + Import Library, can you import the LiquidCrystal library? If not, it isn't installed in the right place, for 0015.

I just got 22 to give it a whirl.

Thank you very much for the tip PaulS!

Ill try the "Using Sketch + Import Library" trick and see what happens.

The current version is 22.

Since the "News" section of this forum is defunct how does one find out about new releases? Using one of the social networking sites is not an acceptable solution to me.

Don

It's on the Download page of the main site. It's also been mentioned in a few threads.

I agree, though, that publication of a new version is worth mentioning in the News forum. Surely the admins can post new threads there.

Cool well I moved the example files into the “libraries” dir and it worked…

I have another quick question for the pro’s out there…

In regards to this piece of code:

lcd.print("SET.TEMP “);
lcd.print((int)(Setpoint) );
lcd.setCursor( 0,1);
lcd.print(” AIR.TEMP: ");
inpt = (int)(inpt * ALPHA + (1.- ALPHA) * Input);
lcd.print( inpt );
lShowTime = millis();


Does anyone know why the readout on my LCD that displays the AIR.TEMP, which is a reading from a thermo couple, seems to readout normally whilst at startup, but once the system runs through a heating cycle, the readout increases to display the temp but when the cycle is ended and it is obvious that my heater is cooling off the “AIR.TEMP” readout continues to stay really high…

Almost as if there is something wrong with the math or averaging of this line of code:
inpt = (int)(inpt * ALPHA + (1.- ALPHA) * Input);

It just goes up and seems to stick there… like it doesn’t read and average correctly.

Is there anything obviously wrong there? or a way to make it better?

inpt = (int)(inpt * ALPHA + (1.- ALPHA) * Input);

Basically you are adding to 'inpt' constantly.

A = ( A * ALPHA + (1 - ALPHA) * Input)

Is not different to the expression A = A++ ... somehow. There is no way to have a smaller value, since every cycle you are adding to the value 'inpt'.

If you can explain the algorithm, we might have a better idea of what you are tying to do here.

I don't understand why you are multiplying 'inpt' in the first place. I have the hunch that you are trying to do is:

inpt = (int) ((1.- ALPHA) * Input);  // ... instead.

... or something similar, but avoiding the value 'inpt' on the same algorithm, otherwise this will become a parasite value adding itself cycle after cycle.

Either way, try to breakdown the algorithm and we'll be able to give you the solution.

Basically all I am trying to accomplish is to be able to display the "inpt" to the LCD wich is represented by "AIR.TEMP"

I had someone code most of it for me and I am not sure why he has that line so complex...

All I am trying to do is display the process variable (AIR.TEMP)... So it can be read and is somewhat smooth.

Since the sample rate is about 250ms.... I am guessing his attempt was to smooth the out the display readout somehow....

Does that shine a little light on why that could be like it is?

I remember us running into a little trouble with the fast sample rate before .... then he was able to correct it... but that was before my HDD crashed and I lost the final code and his info... but I know that this is close to complete... It's just got a few kinks.

"AIR.TEMP" is just the LCD print out description for 'inpt'.

So, yes. You are trying to print the 'inpt' value. But, since 'inpt' is parasite on his own algorithm you'll have an exponential grow no matter what.

That's all I can tell you since I am not familiar with the PIDLibrary, but your algorithm doesn't looks right on the PIDLibrary's context anyway.

You should start from scratch with the PIDLibrary and pinpoint the problem. http://www.arduino.cc/playground/Code/PIDLibrary

Sorry that's my limit today since I have no temp sensor to test the code.