Thanks for the replys, I have read the examples and I feel like the code is right now but it still doesnt display on the LCD. It does not throw errors it just doesnt display.
The code I am speaking about I put markers in the program to help identify. The markers look like this //---------------------------
Thanks
#include <LiquidCrystal.h>
//LiquidCrystal RS, E, 4, 5, 6, 7);
LiquidCrystal lcd(8, 9, 10, 11, 12, 13); // put your pin numbers here
const int button = 2; //Defines the button as output 11
const int handpiece = 4; // Defines the handpiece as output 13
const int valve = 3; //Defines the valve as output 12
const int delay1 = 5000; //time to leave the handpiece on before testing
const int delay2 = 5000; //time to leave the valve on
const int delay3 = 10000; //time to leave results on screen
int buttonstate = 0;
// the setup routine runs once when you press the button
void setup() { //This function gets called when the Arduino starts
lcd.begin(20, 4); // put your LCD parameters here
lcd.print("Press Button");
lcd.setCursor(0,1);
lcd.print("To Start Test");
pinMode(button, INPUT_PULLUP);
digitalWrite(button, HIGH); //Powers the button
pinMode(handpiece, OUTPUT);
digitalWrite(handpiece, LOW); // Verifies handpiece is off
pinMode(valve, OUTPUT);
digitalWrite(valve, LOW); // Verifies valve is off
}
double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = log(((10240000 / RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp )) * Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celsius
Temp = (Temp * 9.0) / 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius
return Temp;
}
void loop() {
buttonstate = digitalRead(button);
if (buttonstate == LOW) {
lcd.clear();
//Display Test Running
lcd.print("Test");
lcd.setCursor(0,1);
lcd.print("Running");
digitalWrite(handpiece, HIGH); // turn the handpiece on
delay(delay1); // time to leave handpiece on
//Take Speed Reading
int tach = analogRead(A0);
float tachvoltage = (tach * (5.0 / 1023.0))*20000;
//Take Sound Reading
int sound = analogRead(A1);
float soundvoltage = (sound * ((5.0 / 1023.0)) * 100)-13;
//Take Temp Reading
double temp;
int temperature = analogRead(A2);
temp = Thermister(temperature);
digitalWrite(valve, HIGH); // turn the valve on
lcd.clear();
//Display Test Running
lcd.print("Check for A1");
lcd.setCursor(0,1);
lcd.print("Alert on Console");
delay(delay2); // time to leave valve on
digitalWrite(valve, LOW); // turn the valve off
digitalWrite(handpiece, LOW); // turn the handpiece off
lcd.clear();
lcd.print("Test");
lcd.setCursor(0,1);
lcd.print("Completed");
delay(2000);
lcd.clear();
//Display Temperature
lcd.setCursor(0,0);
lcd.print("Temp");
lcd.setCursor(6,0);
lcd.print(temp);
lcd.setCursor(12,0);
lcd.print("Deg F");
//Display Speed
lcd.setCursor(0,1);
lcd.print("Speed");
lcd.setCursor(6,1);
lcd.print(tachvoltage);
lcd.setCursor(15,1);
lcd.print("RPM");
//Display Sound
lcd.setCursor(0,2);
lcd.print("Sound");
lcd.setCursor(6,2);
lcd.print(soundvoltage);
lcd.setCursor(12,2);
lcd.print("dB");
delay(delay3);
lcd.clear();
//----------------------------------------
if (tachvoltage > 79000 && tachvoltage < 81000) {
lcd.print("Speed Result");
lcd.setCursor(14,0);
lcd.print("Pass");
}
else {
lcd.print("Speed Result");
lcd.setCursor(14,0);
lcd.print("Fail");
}
//----------------------------------------
lcd.clear();
lcd.print("Press Button");
lcd.setCursor(0,1);
lcd.print("To Start Test");
}
else {
digitalWrite(valve, LOW); // turn the valve off
digitalWrite(handpiece, LOW); // turn the handpiece off
}
}