Skip to content

Commit 669c7d0

Browse files
update
1 parent 31b8c98 commit 669c7d0

11 files changed

Lines changed: 12 additions & 29 deletions

File tree

images/physical_prototype.png

1.6 MB
Loading

project/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
sleep(0.1)
88

99
# File name of the script to import
10-
file_name = "v02"
10+
file_name = "v01"
1111

1212
# Add the path to the sys.path
1313
sys.path.append("/py_scripts")

project/py_scripts/v05.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@ def off(self):
2626
if self.__debug:
2727
print(f"LED connected to Pin {self.__pin} is low")
2828

29-
def toggle(self):
30-
# method overriding polymorphism of the parent class
31-
if self.value() == 0:
32-
self.high()
33-
if self.__debug:
34-
print(f"LED connected to Pin {self.__pin} is high")
35-
elif self.value() == 1:
36-
self.low()
37-
if self.__debug:
38-
print(f"LED connected to Pin {self.__pin} is low")
39-
4029

4130
red_light = Led_Light(3, False, False)
4231

tutorials/Lecture0.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Introduction Projects
1010

11-
The Introduction projects should be completed before starting the OOP Mini Project. Ultimately, students should have a basic understanding of the following concepts: different sensors and actuators, wiring a breadboard, Unit Testing, and debugging software and hardware.
11+
The Introduction projects should be completed before starting the OOP Mini Project. Ultimately, students should have a basic understanding of the following concepts: different sensors and actuators, wiring a breadboard, Unit Testing, and debugging both software and hardware.
1212

1313
| | |
1414
| --- | --- |
@@ -45,11 +45,10 @@ First students should copy the provided script [v02.py](..\project\py_scripts\v0
4545
2. The buzzer should emit animated musical note on screen and if volume is turned up a constant tone.
4646
3. The momentary switch should return `1` to the IDE terminal when closed (pressed) and 0 when not closed (depressed).
4747

48-
## Physical Wiring
49-
48+
## Physical Breadboard Protoytype
5049
Watch the [Pi Pico Breadboard Introduction Video](https://www.youtube.com/watch?v=Ex7AJll-FsM). Students should wire their board, then unit test using the provided script [v02.py](..\project\py_scripts\v02.py).
5150

52-
### Physical Prototype
51+
### Finished Prototype
5352

5453
![Physical Prototype](/images/physical_prototype.png)
5554

tutorials/Lecture1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The PWM Library provides an interface for controlling PWM signals on a specified
9393

9494
## Instantiation
9595

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.
96+
A class is like a blueprint for an object—it defines the attributes and methods the object will have, but it isn’t an actual object itself. Instantiation is the process of using the class to create a real, usable object in memory.
9797

9898
```python
9999
from machine import Pin
@@ -112,9 +112,9 @@ while(True):
112112

113113
## Inheritance
114114

115-
Inheritance is a fundamental concept in object-oriented programming (OOP). It allows a class (called a child or subclass) to acquire properties and behaviours (methods and attributes) from another class (called a parent or superclass).
115+
Inheritance is a fundamental concept in object-oriented programming (OOP). It allows a class (called a child or subclass) to inherit properties and behaviours (methods and attributes) from another class (called a parent or superclass).
116116

117-
In this case the Led_Light class inherits the Pin class and without any further instrcutions the sub class inherits and can call all the mthods of the super class including `on()`, `off()`, `high()`, `low()`, `toggle()`, etc.
117+
In this case, the `Led_Light` class inherits from the Pin class, and without any further instructions, the subclass inherits and can call all the methods of the superclass, including `on()`, `off()`, `high()`, `low()`, `toggle()`, etc.
118118

119119

120120
```python

tutorials/Lecture2.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
## UML Class Diagrams
1010

11-
What is a UML Class Diagram?
1211
A UML (Unified Modelling Language) class diagram visually describes the structure of a system by showing its classes, their attributes (variables), methods (functions), and relationships (like inheritance).
1312

1413
```text
@@ -23,7 +22,7 @@ A UML (Unified Modelling Language) class diagram visually describes the structur
2322
----------------------
2423
```
2524

26-
Mermaid Markdown UML Class Diagram Example
25+
### Mermaid Markdown UML Class Diagram Example
2726
Below is a Mermaid class diagram for a Pi Pico GPIO Pin and a custom Led_Light class that inherits from it.
2827

2928
```mermaid
@@ -54,19 +53,17 @@ Explanation:
5453

5554
1. Class Name (Top Section): This is the uppermost part of the box. It displays the name of the class (e.g., Student, Order, Car).
5655
2. Attributes (Middle Section): This section lists the attributes (or properties/fields) of the class. Each attribute is typically shown with its visibility (+ for public, - for private, # for protected), name, and type.
57-
3. Methods/Operations (Bottom Section): This section lists the methods (or operations/functions) that belong to the class.
56+
3. Methods (Bottom Section): This section lists the methods (or operations/functions) that belong to the class.
5857
Each method is shown with its visibility, name, parameters, and return type.
5958
4. Connections (lines and arrows): These lines and arrows represent relationships (such as inheritance, association, aggregation, and composition) between class boxes.
6059

6160
## Overriding Polymorphism
6261

6362
**Polymorphism means “many forms.”**
6463

65-
Overriding is when a child (subclass) provides a new implementation for a method that it inherits from its parent (superclass).
64+
Polymorphism Overriding occurs when a child class (subclass) provides a new implementation for a method it inherits from its parent class (superclass).
6665

67-
The child class method has the same name and parameters as the method in the parent class. When you call the method on a child class object, Python (or any OOP language) uses the child’s version—even if the object is referenced by the parent type.
68-
69-
It is called 'overriding' or also compilation polymorphism, as in many languages like C++ or C#, the overridden (parent method) is not compiled at all.
66+
The method in the child class has the same name and parameters as the one in the parent class. When the method is called on an object of the child class, Python (or any object-oriented language) uses the child’s version—even if the object is referenced using the parent type.
7067

7168
```python
7269
from machine import Pin
@@ -172,8 +169,6 @@ Overloading occurs when a child (subclass) and/or parent (superclass) have multi
172169

173170
When you call the method, depending on the parameters passed, the corresponding method is executed.
174171

175-
It is called 'overloading' or also known as runtime polymorphism, as in many languages like C++ or C#, all the methods are compiled. However, depending on the parameters, the appropriate method is executed at runtime.
176-
177172
Because Python is dynamically typed, it does not support overloaded polymorphism, as the last definition of a method overwrites any previous ones.
178173

179174
```pseudocode

tutorials/Lecture3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Complete led light class
99

1010
## Encapsulation
11-
Encapsulation restricts direct access to some of an object's components (attributes or methods), which means that the internal representation of an object is hidden from the outside. This is typically achieved by making certain attributes or methods private (i.e., not accessible from outside the class) and providing public methods (such as getters and setters) to access or modify those private members.
11+
Encapsulation restricts direct access to some of an object's components (such as attributes or methods), meaning the internal representation of the object is hidden from the outside. This is typically achieved by making certain attributes or methods private (i.e., inaccessible from outside the class) and providing public methods (such as getters and setters) to access or modify those private members.
1212

1313
### Benefits of Encapsulation:
1414

8.65 MB
Binary file not shown.
5.3 MB
Binary file not shown.
3.54 MB
Binary file not shown.

0 commit comments

Comments
 (0)