Electrical Engineering Student | University of Texas at Dallas
Designed a thermistor-based temperature system that triggers an LED when exceeding 80°F.
We created a project to drive two 7-segment displays using an Arduino, showcasing how to control digital outputs with an analog joystick input.
Project Overview:
This project involves using an analog joystick to control two 7-segment displays via an Arduino. The joystick's X-axis input is read by the Arduino, which converts the analog signal into two 4-bit numbers. These numbers are then output to the 7-segment displays, showing values from 00 to 99.
Key Components:
- Arduino microcontroller
- Analog joystick
- Two 7-segment displays
- Resistors
- Breadboard and jumper wires
Key Features:
- Real-time control of 7-segment displays using a joystick
- ADC conversion for precise analog input reading
- 4-bit digital output to drive 7-segment displays
#define sensorPin A0
int pin12 = 12;
void setup() {
// put your setup code here, to run once:
pinMode(pin12, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int reading = analogRead(sensorPin);
float voltage = reading * (5.0 / 1024.0);
float temperatureC = (voltage - 0.5) * 100;
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.print("\xC2\xB0");
Serial.print("C | ");
float temperatureF = (temperatureC * 9.0 / 5.0) + 32;
Serial.print(temperatureF);
Serial.print("\xC2\xB0");
Serial.print("F");
if(temperatureF > 78){
digitalWrite(pin12, HIGH);
} else if(temperatureF <= 78){
digitalWrite(pin12, LOW);
}
Serial.println("\n");
delay(1000);
}