##
## Example for the Seven Segment display Driver
##
# Import required libraries
from machine import ADC
from machine import Pin
import utime
import hidden
from seven_segment import SegDisplay
# define GPIO pins to use, matching: 'A', 'B', 'C', 'D', 'E', 'F', and 'G'
# segments on the displays. Two lists are used, one for each segment.
seg_list1 = [2, 3, 4, 5, 6, 7, 8]
seg_list2 = [10, 11, 12, 13, 14, 15, 16]
# Create the seven-segment display objects, each attached to the relevant
# segment using the `SegDisplay` driver class
segDisp1 = SegDisplay(seg_list1)
segDisp2 = SegDisplay(seg_list2)
# Read the input value from ADC0 on GPIO Pin 26
adc = ADC(26)
# Set-up the main loop to read and display the input values
while True:
adcval = adc.read_u16()
temp = hidden.measureval(adcval)
segDisp2.display(int(temp % 10))
segDisp1.display(int((temp / 10) % 10))
utime.sleep(1)