I have just a basic 4 digit 7 segment display that I'd like to use simply as a readout, for example a thermometer or a distance measurement from an ultrasonic sensor.
So i've gone through and got the thing working as a stopwatch and a few various other things, using other people's libraries and code.
What I'm wondering is if there is a library out there where I just call for it, then place whatever variable inside it, as to be displayed? Or do I need to go and write the code doing all the multiplexing and what not myself, surely there is a simpler alternative that has been used before.
float tempC;
int tempPin = 0;
int ledPin = 13; // blue LED connected to pin 13
void setup() {
Serial.begin(9800); //opens port to send sensor data
pinMode(ledPin, HIGH);
}
void loop() {
tempC = analogRead(tempPin); // takes tempPin reading and setting it to tempC
tempC = (tempC/1024)*900+32; // convert analog voltage input to temperature in celsius
Serial.println((byte)tempC); // will output temp to computer
if (tempC >80)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
delay(200);
}
So instead of using serial.println((byte)tempC; how do I substitute that with something which would print the numbers to my 4 digit 7 segment display?
Thanks for any replies,
Yes, I'm new at this..