Hi, I was wondering if anyone can help me? I am currently part of a team taking part in the EESW project at Gower College Swansea, I have been programming an arduino uno to read and display the current temperature of the room it's in. It is connected to a thermistor and a 10k resistor.
So this is where I need help, I want to display said value on to the tft screen by arduino, I am aware it is currently no longer supported but this is all we've had access to in the college. I have managed to created the code for the arduino to read and display the temperature in Celsius like I wanted but I don't know how to get it to display to the tft screen, please help this is urgent.
Here is my code to view the temperature, it display in the onboard serial monitor inside the arduino software:
// char array to print temp
char printout[4];
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(115200);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 95.0);
// print out the value you read:
Serial.println(voltage);
}
I need the results of the original code I posted to display on said screen, I'm not sure how to code it to do that. I'm very new to code I have only learnt bare basics before now and that was in visual basic.
If you're very lucky, after a bit of initialisation, setting font size and cursor positioning, it may be as simple as replacing Serial.println(voltage); with tft.print(voltage);
(Sorry, I don't have this device - you'll need to look at the example code - hopefully there's a "Hello world" which is within spitting distance of what you want)
// char array to print temp
char printout[4];
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(115200);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 95.0);
// print out the value you read:
tft.println(voltage);
}
// char array to print temp
char printout[4];
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(115200);
TFTscreen.begin();
TFTscreen.background(0, 0, 0);
TFTscreen.stroke(255,255,255);
TFTscreen.setTextSize(2);
TFTscreen.text("Sensor Value : ",0,0);
TFTscreen.setTextSize(5);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 95.0);
// print out the value you read:
tft.println(voltage);
}