ADC is used by most of the sensors for eg- temperature sensor, force sensor, IR sensor, potentiometer, and many more. All these sensors send the data to the microcontroller in analogue form, which then converts it into digital values.
The process is very straight forward, you have to measure the number of times input pin goes high and low in 1 second. This measure will give you the frequency.
1.) Set a pin as input and make sure you connect a pull-up register to it. Pull-up is necessary otherwise pin will not go to high state.
2.) Give in the frequency input to the pin and display the frequency on the serial terminal via UART.
let’s say I want to display ‘1’, so I can do that by turning on segments ‘b’ and ‘c’ (you can also turn segments ‘f’ and ‘e’ on). To display ‘5’, I have to turn on ‘a’, ‘f’, ‘g’, ‘c’ and ‘d’ and so on.
That’s all you need to know for seven segment display. It’s very simple and used widely.
While assigning a pin as an input, always remember that we have to use Pull-up resistor. Pull-up resistor is just like a normal resistor, connected between the line (the input) and Vcc. So by default, it pulls the line high or you can say input is high (1).