Classes
Classes and objects on a BME280: the driver class you already use, a Reading class of your own with methods and __str__, an object that remembers the highest temperature, and inheritance.
Open it in the simulatorAdvanced Python on a Raspberry Pi, after Python from zero: modules, classes, exceptions, files and logging, tests with plain assert, generators, and a sensor logger that uses them all.
0 of 7 done
7 lessons in 4 chapters, about 6 hours on a simulated Raspberry Pi 4 Model B. Free, in your browser, every step checked by the simulator.
Classes and objects on a BME280: the driver class you already use, a Reading class of your own with methods and __str__, an object that remembers the highest temperature, and inheritance.
Open it in the simulatorWrite a knob's readings to a file and read them back, a CSV any spreadsheet opens, the logging module with its levels in place of print, and a log file: what the Pi's engine supports, and what lasts.
Open it in the simulatoryield and next, a generator that streams knob readings forever, a moving average built as a pipeline of generators, islice to take just a few, and generator expressions.
Open it in the simulatorEach lesson opens when the one before it is done, and each chapter ends in a project.
Split code into modules, and bundle data with its functions in classes.
Split a program into files: the OLED driver you have been importing all along, the standard library, a module of your own in a new tab, and what __name__ == "__main__" is for.
0 of 6 steps
Classes and objects on a BME280: the driver class you already use, a Reading class of your own with methods and __str__, an object that remembers the highest temperature, and inheritance.
0 of 6 steps
Exceptions, files and logs: code that survives a loose wire and tells you what happened.
Read a traceback, catch the I2C error a missing chip really raises, scan two addresses without crashing, raise an exception of your own, and clean up with else and finally.
0 of 6 steps
Write a knob's readings to a file and read them back, a CSV any spreadsheet opens, the logging module with its levels in place of print, and a log file: what the Pi's engine supports, and what lasts.
0 of 6 steps
Tests with assert, and generators that stream data forever.
No pip and no pytest, so tests are plain assert: catch a real off-by-one in a voltage conversion, test the edges, write a ten-line test runner, and let a failing test drive a fix.
0 of 6 steps
yield and next, a generator that streams knob readings forever, a moving average built as a pipeline of generators, islice to take just a few, and generator expressions.
0 of 6 steps
A sensor logger with a screen, a CSV and a log, built from every habit in the course.
The boss project: a BME280 and an OLED on one I2C bus, a logger module with a Sample class and a generator of samples, a test before anything is trusted, a CSV log, the latest reading on the screen and a warning when it gets hot.
0 of 7 steps
All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.
Python with real habits is part of the coding track, a ladder of courses from zero to expert.
The ideas every programmer is asked about, built and measured on an Uno: big O, linked lists, stacks and queues, hash maps, sorting and binary search. Ends with a leaderboard that needs them all.
Open the next coursePython and C++ from your first print to classes, tests and state machines. Every program runs on a simulated board, so a bug is something you can see.
See every course on the trackEvery lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.
Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kitYes. All 7 lessons of Python with real habits are free and run in your browser, with nothing to install and no parts to buy before you start.
No. Every lesson runs on a simulated Raspberry Pi 4 Model B with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.
About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.
Each chapter ends in a project that puts it together: Classes, Files and logging and Generators.
With "Modules", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.