You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sm=rp2.StateMachine(0, wave_prog, freq=1953125, set_base=Pin(SPEAKER_PIN)) # the clock frequency of Raspberry Pi Pico is 125MHz; 1953125 is 125MHz / 64
37
31
sm.active(1)
38
32
defHWPlayTone(freq: int, duration: int):
39
-
halfWaveNumCycles=round((100000.0/2)/freq) # 2 is the number of cycles per half wave
33
+
halfWaveNumCycles=round(1953125.0/freq/2) # count 1 cycle for jmp() ==> 1 cycle per half wave ==> 2 cycles per wave
40
34
waveCount=round(duration*freq/1000.0)
41
35
sm.put(waveCount)
42
-
sm.put(halfWaveNumCycles)# 2 * (x / 10) == blink time
0 commit comments