I'm working on a buzzer that has to make a simple sound. But I can't figure out about how to make this buzzer work in MicroPython. I've already tried the following code but it is not doing much. I'm a little bit stuck at this.
import pycom
import machine
import time
from machine import Pin
import board
import pulseio
buzzer = pulseio.PWMOut(board.D16, variable_frequency=True)
def main():
buzzer.duty_cycle = ON
buzzer.frequency = 440
buzzer.duty_cycle = OFF
if __name__ == "__main__":
main()
For more information about what I use as materials:
Buzzer:https://datasheet4u.com/datasheet-pdf/Ningbo/KPT-1410/pdf.php?id=868269
The materials for my project is this:
I think i'm getting close to it, but can't figure it out.