This library helps calibrating a sound sensor KY038 with the micro:bit. It also provides a clap counter functionality. It assumes the Digital output of the sound sensor is connected to pin0 of the micro:bit. It uses an analog input, since the digital input seems not to be very reliable powering the sensor with 3V. Power and ground of the sensor are also connected to the micro:bit.
- Helps calibrate the sound sensor showing an arrow on the micro:bit indicating the direction to turn the potentiometer
- Has a clap counter included
Inititalizes the calibration routine. The micro:bit will display an arrow indicating the direction that you should be turning the potentiometer with a screwdriver.
from ky038 import KY038
KY038.calibrate()
Count the number of claps or any consecutive sudden sound.
from ky038 import KY038
KY038.calibrate()
while True:
print(KY038.count_claps())