You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Pin library in MicroPython for the Pi Pico allows you to control the General Purpose Input/Output (GPIO) pins of the Pico. It allows you to configure pins as digital (binary) inputs or outputs.
The PWM Library provides an interface for controlling PWM signals on a specified GPIO pin. It allows you to configure any GPIO pin as a PWM and set the duty cycle and frequency.
22
10
23
11
## Unit Testing
24
12
@@ -39,6 +27,8 @@ classDiagram
39
27
+value()
40
28
+high()
41
29
+low()
30
+
+high()
31
+
+low()
42
32
+toggle()
43
33
}
44
34
@@ -65,10 +55,9 @@ classDiagram
65
55
+__init__(pin: int, flashing: bool, debug: bool)
66
56
+on()
67
57
+off()
58
+
+high()
59
+
+Low
68
60
+toggle()
69
-
+flash(duration: int)
70
-
+on_for(duration: int)
71
-
+led_light_state: int
72
61
}
73
62
Pin <|-- Led_Light : Inheritance
74
63
@@ -86,6 +75,22 @@ classDiagram
86
75
87
76
```
88
77
78
+
## Generalisation
79
+
80
+
On the Pi Pico, the Pin and PWM libraries are designed to be generalised to provide flexible and reusable interfaces for interacting with the microcontroller’s hardware. The simple `on()`, `off()` or `high()`, `low()` methods are not specific to any hardware but are generalised to the nature of a digital GPIO Pin. As a generalised class is inherited and the classes are extended, they become more specific (less generalised) and functional to specific hardware for which they are designed.
The Pin library in MicroPython for the Pi Pico allows you to control the General Purpose Input/Output (GPIO) pins of the Pico. It allows you to configure pins as digital (binary) inputs or outputs.
The PWM Library provides an interface for controlling PWM signals on a specified GPIO pin. It allows you to configure any GPIO pin as a PWM and set the duty cycle and frequency.
93
+
89
94
## Instantiation
90
95
91
96
A class is like a blueprint for an object—it defines what attributes and methods the object will have, but by itself, it isn’t an actual object. Instantiation is when you use the class to create an actual, usable object in memory.
@@ -137,7 +142,3 @@ while True:
137
142
red_light.toggle()
138
143
sleep(4)
139
144
```
140
-
141
-
## Generalisation
142
-
143
-
On the Pi Pico, the Pin and PWM libraries are designed to be generalised to provide flexible and reusable interfaces for interacting with the microcontroller’s hardware. The simple `on()`, `off()` or `high()`, `low()` methods are not specific to any hardware but are generalised to the nature of a digital GPIO Pin. As a generalised class is inherited and the classes are extended, they become more specific (less generalised) and functional to specific hardware for which they are designed.
0 commit comments