Tutorial Series Sponsor PCBWay Website. You can get extra free coupons using the link below:
A micro-controller can read the status of several buttons using only one pin using ADC with the help of a simple voltage divider circuit. The most effective way of doing digital read is to perform it using DMA, which will let the CPU not get busy while sampling the read voltage level continuously. This piece of code shows uses one of the algorithms used to debouce buttons by the software while trying to read them.
The project has been developed to include more buttons and a buzzer that can play musical notes by pressing the buttons.
STM32 micro controller is used to implement the algorithm used to trigger several different events, which are single press, double press and held pressed, form one single push button is explained with the necessary measurements that the code is based on.
STM32 MCU is used to interface PCF8574 Pin Expander over I2C to control 8 LED sound level indicator using only 2 pins. Both hardware and software are explained in details. All tutorial materials are shared in the GitHub Repository.