Created
December 1, 2023 12:47
-
-
Save soup-bowl/f676fa8bafed0a9d254abcae67e9e765 to your computer and use it in GitHub Desktop.
KY-038 sensor using MicroPython - https://techatronic.com/sound-sensor-pi-pico/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from machine import Pin | |
from time import sleep | |
vu=Pin(15,Pin.OUT) | |
di=Pin(16,Pin.IN) | |
while True: | |
try: | |
if di.value()== True: | |
vu.value(True) | |
sleep(0.5) | |
else: | |
vu.value(False) | |
except KeyboardInterrupt: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you buy one of these, you don't need the LED unless you're testing outputs like I am here. You could literally just provide PWR and GND to the chip, and LED2 on the board indicates whether sound is currently being detected on the potentiometer setting (LED1 is just PWR indicator).