File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 2
2
"""Test script for VS Code debugging with MicroPython debugpy."""
3
3
4
4
import sys
5
+
5
6
sys .path .insert (0 , '.' )
6
7
7
8
import debugpy
8
9
10
+ foo = 42
11
+ bar = "Hello, MicroPython!"
12
+
9
13
def fibonacci (n ):
10
14
"""Calculate fibonacci number (iterative for efficiency)."""
11
15
if n <= 1 :
@@ -17,13 +21,15 @@ def fibonacci(n):
17
21
18
22
def debuggable_code ():
19
23
"""The actual code we want to debug - wrapped in a function so sys.settrace will trace it."""
24
+ global foo
20
25
print ("Starting debuggable code..." )
21
26
22
27
# Test data - set breakpoint here (using smaller numbers to avoid slow fibonacci)
23
28
numbers = [3 , 4 , 5 ]
24
29
for i , num in enumerate (numbers ):
25
30
print (f"Calculating fibonacci({ num } )..." )
26
31
result = fibonacci (num ) # <-- SET BREAKPOINT HERE (line 26)
32
+ foo += result # Modify foo to see if it gets traced
27
33
print (f"fibonacci({ num } ) = { result } " )
28
34
print (sys .implementation )
29
35
import machine
You can’t perform that action at this time.
0 commit comments