timegalore
horizontal bar
horizontal bar
Temperature Measurement and LED Display Project - Code
Here is the code for this project

// Project 3 - Display Temperature on a scrolling 16x2 LCD Matrix
#include <LiquidCrystal.h>


// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(10, 9, 5, 4, 3, 2);

// pin for the potentiometer to control the scrolling speed
int potPin = 5;

// pin for reading the temperature
int tempPin = 4;

void setup() {

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

  // set up for serial keyboard input
  Serial.begin(9600);
  Serial.flush();

  //set pins to output
  pinMode(potPin, INPUT);
  pinMode(tempPin, INPUT);
  analogReference(INTERNAL);
 }

void loop() {

  long counter1 = 0;
  long counter2 = 0;

  char reading[10];
  char buffer[18];

  if (counter1++ >=100000) {
    counter2++;
  }
  if (counter2 >= 10000) {
    counter1 = 0;
    counter2 = 0;
  }


  getTemp(reading);

    // 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(reading);

  delay(1000);

  /*  if (isKeyboardInput()) {
   char readBuffer[50];
   Serial.println ("read: ");
   getKeyboardInput(readBuffer, 49);
   Serial.print (readBuffer);
   Serial.flush();
   } */
}


boolean isKeyboardInput() {

  // returns true is there is any characters in the keyboard buffer
  return (Serial.available() > 0);
}

void getKeyboardInput(char* readString, int readStringLen)
{
  // take a buffer readString and fill it with characters from the
  // keyboard stream up to readStringLen characters
  int index=0;
  int numChar;
  delay (500);
  while (numChar = Serial.available()) {
    while (numChar-- && (index < readStringLen)) {
      readString[index++] = Serial.read();
    }
  }

  // terminate the string
  readString[index] = '\0';
}

void getTemp(char* reading) {

  int span = 20;
  int aRead = 0;
  long temp;
  char tmpStr[10];

  // average out several readings
  for (int i = 0; i < span; i++) {
    aRead = aRead+analogRead(tempPin);
  }

  aRead = aRead / span;

  temp = ((100*1.1*aRead)/1024)*10;

  reading[0] = '\0';

  itoa(temp/10, tmpStr, 10);
  strcat(reading,tmpStr);
  strcat(reading, ".");
  itoa(temp % 10, tmpStr, 10);
  strcat(reading, tmpStr);
  strcat(reading, "C");

}


			
horizontal bar