SEN136B5B is a Ultra Sonic range measurement from SeedStudio. It can measure the distance by sending a 40k Hz ultra sound impulse via the transmitter and calculating time needed for echo to reach receiver. Detecting range: 3cm-4m. More information about device.
After sorting out how works 16 bit hardware timer it is time for 4 digits countdown timer. Having 16 bit timer and 7 segments LED code from earlier only were remaining to write timer’s modes (run/setup) and button’s control code. After putting all code to one place there is countdown timer with properties below:
Maximum 99 minutes 59 seconds countdown interval
1 second resolution
Sound indication with buzzer for finished countdown
LED indicates running timer, or relay instead for powering external devices for some period of time
2 buttons to set timer and start/pause/reset.
This time without additional code quotation, please find some code explanation within code, so code bellow.