#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#define SENSOR A0
#define TFT_DC 9
#define TFT_CS 10
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
lcd.setCursor(5,0);
lcd.print("H15 Pharos");
// initialize serial communication at 9600 bits per second:
//Serial.begin(9600);
void setup() {
tft.begin();
tft.setCursor(26, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("Hello, TFT!");
tft.setCursor(20, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("I can has colors?");
}
void loop() { }
}
// the loop routine runs over and over again forever:
void loop() {
lcd.init();
lcd.backlight();
float psi = 1.0;
float voltage =1.0;
int adcVal = 0;
adcVal = analogRead(SENSOR);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
voltage = adcVal*5/1024.0;
psi = voltage*200/4.5-5.5;// cal factor of 5.5
// print out the value you read:
//Serial.print("Voltage: ");
// Serial.println(voltage);
//Serial.print("PSI: ");
//Serial.println(psi);
lcd.setCursor(0,0);
lcd.print("Voltage: ");
lcd.print(voltage);
lcd.setCursor(0,1);
lcd.print("PSI: ");
lcd.print(psi);
}