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 22"""Test script for VS Code debugging with MicroPython debugpy."""
33
44import sys
5+
56sys .path .insert (0 , '.' )
67
78import debugpy
89
10+ foo = 42
11+ bar = "Hello, MicroPython!"
12+
913def fibonacci (n ):
1014 """Calculate fibonacci number (iterative for efficiency)."""
1115 if n <= 1 :
@@ -17,13 +21,15 @@ def fibonacci(n):
1721
1822def debuggable_code ():
1923 """The actual code we want to debug - wrapped in a function so sys.settrace will trace it."""
24+ global foo
2025 print ("Starting debuggable code..." )
2126
2227 # Test data - set breakpoint here (using smaller numbers to avoid slow fibonacci)
2328 numbers = [3 , 4 , 5 ]
2429 for i , num in enumerate (numbers ):
2530 print (f"Calculating fibonacci({ num } )..." )
2631 result = fibonacci (num ) # <-- SET BREAKPOINT HERE (line 26)
32+ foo += result # Modify foo to see if it gets traced
2733 print (f"fibonacci({ num } ) = { result } " )
2834 print (sys .implementation )
2935 import machine
You can’t perform that action at this time.
0 commit comments