//define Potentiometer pin
#define potPin A0
#include <LiquidCrystal.h>
LiquidCrystal lcd(6,7,5,4,3,2);
void setup() {
// put your setup code here, to run once:
//serial begin and test
Serial.begin(115200);
Serial.println("Hello");
delay(1000);
/*setup lcd, set LCD 16 col 2 row,
display into message */
lcd.begin(16,2);
lcd.print(" ARDUSPRAY");
lcd.setCursor(0,1);
lcd.println("Controller V1.0");
delay(1000);
lcd.clear();
//set potentiometer pin as input
pinMode(potPin, INPUT);
}
void loop() {
int potAnalog = analogRead(A0);
int targetPressure = 50;
//scale pot voltage
float potVoltage = potAnalog * (5.0 / 1023.0);
//scale for 100 psi pressure transducer
float sysPressure = potAnalog * (100.0 / 1023.0);
Serial.println(potAnalog);
Serial.println(potVoltage);
Serial.println(sysPressure);
// print pressure, target pressure, rpm to lcd routine
lcd.print("Target:");
lcd.print(targetPressure);
delay(1000);
lcd.clear();
}