Mi primer programa
Abrimos Thomy nuevo archivo y pegamos un código por ejemplo este https://docs.keyestudio.com/projects/KS5009/en/latest/docs/Python/Python.html#project-4-1-play-happy-birthday
from machine import Pin, PWM
from time import sleep
### EN LA SMARTHOME ESP32 EL BUZZER ESTA EN EL 25
## EN LA TDR STEAM EL BUZZER ESTA EN EL 8
buzzer = PWM(Pin(8))
buzzer.duty(1000)
# Happy birthday
buzzer.freq(294)
sleep(0.25)
buzzer.freq(440)
sleep(0.25)
buzzer.freq(392)
sleep(0.25)
buzzer.freq(532)
sleep(0.25)
buzzer.freq(494)
sleep(0.25)
buzzer.freq(392)
sleep(0.25)
buzzer.freq(440)
sleep(0.25)
buzzer.freq(392)
sleep(0.25)
buzzer.freq(587)
sleep(0.25)
buzzer.freq(532)
sleep(0.25)
buzzer.freq(392)
sleep(0.25)
buzzer.freq(784)
sleep(0.25)
buzzer.freq(659)
sleep(0.25)
buzzer.freq(532)
sleep(0.25)
buzzer.freq(494)
sleep(0.25)
buzzer.freq(440)
sleep(0.25)
buzzer.freq(698)
sleep(0.25)
buzzer.freq(659)
sleep(0.25)
buzzer.freq(532)
sleep(0.25)
buzzer.freq(587)
sleep(0.25)
buzzer.freq(532)
sleep(0.5)
buzzer.duty(0)
Al darle a GUARDAR hay que guardarlo en el dispositivo ESP32 pues recuerda que es un Micropython y el compilador esta dentro de la placa.
Al darle al botón play pues suena ...
