Skip to content

Commit 63d818a

Browse files
committed
monitor: hog_detect() produces 1:1 square wave.
1 parent fc40d0d commit 63d818a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

v3/as_demos/monitor/monitor.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,10 @@ def init():
100100
_write(b"z") # Clear Pico's instance counters etc.
101101

102102
# Optionally run this to show up periods of blocking behaviour
103-
@asyn(0)
104-
async def _do_nowt():
105-
await asyncio.sleep_ms(0)
106-
107-
async def hog_detect():
103+
async def hog_detect(i=1, s=(b"\x40", b"\x60")):
108104
while True:
109-
await _do_nowt()
105+
_write(s[(i := i ^ 1)])
106+
await asyncio.sleep_ms(0)
110107

111108
# Monitor a synchronous function definition
112109
def sync(n):

0 commit comments

Comments
 (0)