Topic
Python
Python runs on your PC, next to the board. Eight short insights take you from the REPL to a script that turns a serial log into a spreadsheet. Each one is a 3-minute read with a diagram, code that runs, and the output it prints.
Read the first insightscan.pyPython
log = """00:01 INFO boot ok00:05 ERROR i2c timeout00:09 ERROR i2c timeout"""errors = [l for l in log.splitlines() if "ERROR" in l]print(len(errors), "errors")
Output
2 errors
Insights
-
Python as your workbench
The REPL, scripts, and why Python lives next to the board.
-
Values and types
int never overflows, and str is not bytes.
-
Bits, hex and masks
Decode a register value in three lines.
-
Decisions and loops
Sort log lines, and retry until the board answers.
-
Functions and modules
Small helpers you can import into every script.
-
Bytes and struct
Turn raw bytes from a sensor into numbers you can trust.
-
Classes
A frame parser that keeps its own state.
-
Automating the bench
From a serial log to a CSV in one script.