- MicroPython Cookbook
- Marwan Alsabbagh
- 71字
- 2021-06-24 14:28:11
How to do it...
Let's perform the following steps:
- Run the following lines of code in the REPL:
>>> from adafruit_circuitplayground.express import cpx >>> E5 = 659 >>> C5 = 523 >>> G5 = 784 >>> cpx.play_tone(E5, 0.15)
You should hear the E5 musical note play on the speakers for 0.15 seconds.
- Use the following code to play the C5 and G5 musical notes for 0.15 seconds:
cpx.play_tone(C5, 0.15) cpx.play_tone(G5, 0.15)