The design of the CircuitPython version of the CLUE sensor plotter separates the program into three components using object-oriented programming (OOP):
- A
PlotSource
class with derived classes for each sensor to represent the 10 data sources. - A
Plotter
class to take the data and draw the graph on the LCD screen. - The main program which manages the interactions with the user and uses the aforementioned classes to read the data from the sensors and plot it to the screen.
A class brings together related code and data to create a new type. Variables created based on the class type are referred to as objects. Procedures are called methods when they are part of a class. Python and C++, the basis for CircuitPython and Arduino programming respectively, both have OO features.
The following pages in this section look at a few aspects of the design.
Text editor powered by tinymce.