Try the following setup using SevSeg.h Library.
1. Build the following multiplexed display unit as per Fig-1. In a multiplexed display unit, the identical segments pins are shorted together and the CA-pin are kept isolated. Adjust R1 = R2 = R3 for acceptable brightness of the CA-type display units. Note that the use of inverting type buffer ULN2003 has made the CA-type display unit to have been seen by UNO as CC-type display unit.
Figure-1:
2. Upload the following Sketch. do not forget to include the SevSeg.h Library in your IDE.
#include <SevSeg.h>
SevSeg sevSeg;
void setup()
{
Serial.begin(9600);
byte ccDPins[] = {9, 10, 11}; //9 = cc0-pin/CA0-pin, 10 = cc1/CA1-pin, ...
byte segDPins[] = {2, 3, 4, 5, 6, 7, 8}; //2 = seg-a, 3 = seg-b ...
sevSeg.begin(COMMON_CATHODE, 3, ccDPins, segDPins, false, false, false, false);
analogReference(INTERNAL); //1.1V Vref for ADC
}
void loop()
{
unsigned long prMillis = millis();
while (millis() - prMillis < 2000) //temperature sampling interval is 2-sec
{
sevSeg.refreshDisplay(); //keep refreshing display until 2-sec has elapsed
}
float rawTemp = 100 * ( 1.1 / 1023) * analogRead(A4);// 31.25xxxx...
rawTemp = rawTemp*100.00; //myTemp = 3125.xxxx.......
unsigned int myTemp = (unsigned int)rawTemp; //myTemp = 3125(.(xxxx...) takes onlyinteger part
sevSeg.setNumber(myTemp, 1, LOW); //arg2=digit after point, arg3=base-10
}
3. To know about SevSeg.h Library, you may read the post of this link.