MicroPython Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The initial lines of code import the necessary libraries and set up the constants that are required for the rest of the code in the program. The script then loops for a total of three iterations, with each iteration playing sounds for a total of one second.

In each iteration, a high-pitched tone will be played for a half a second, followed by a low-pitched tone for half a second. In this way, a siren sound effect is created, similar to an alarm.