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
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,16 +74,18 @@ analog_write('A3', 64)
74
74
Will generate a modulated signal on the specified Pin.
75
75
Can be used to control small motors with low current needs as well as servo motors.
76
76
77
-
#### IMPORTANT
78
-
79
-
The numeric value for PIN_NUMBER is usually the processor's GPIO number, while values enclosed in quotes are "named pins" and are platform/implementation specific, not guaranteed to be valid.
80
-
A `ValueError` exception with label "invalid pin" is thrown if the pin number or ID is not valid.
77
+
> [!IMPORTANT]
78
+
> The numeric value for PIN_NUMBER is usually the processor's GPIO number, while values enclosed in quotes are "named pins" and are platform/implementation specific, not guaranteed to be valid. A `ValueError` exception with label "invalid pin" is thrown if the pin number or ID is not valid.
81
79
82
80
### delay(MILLISECONDS)
83
81
84
82
Will halt the execution of your program for the amount of _milliseconds_ specified in the parameter.
85
83
It is to be considered a code-blocking command.
86
84
85
+
```Python
86
+
delay(1000) # Delay the execution for 1 second
87
+
```
88
+
87
89
## Usage
88
90
89
91
The structure of an Arduino MicroPython program will look as follows:
@@ -137,7 +139,7 @@ Is run indefinitely until the program stops.
137
139
138
140
### cleanup()
139
141
140
-
Is run _once_ when the program stops.
142
+
Is run _once_ when the program stops. This happen either when the user manually stops the execution of the program orif an error in the user code is thrown.
141
143
It should contain code such as resetting the value of variables, stopping timers, causing threads to stop running.
142
144
143
145
A `cleanup()` enchanced version of our initial program would look like this
@@ -158,6 +160,9 @@ def cleanup():
158
160
start(setup, loop)
159
161
```
160
162
163
+
> [!NOTE]
164
+
>`cleanup()` does not get called when the program stops because the hardware button on the board was pressed.
165
+
161
166
## Utilities
162
167
163
168
Some utility methods are provided and are still in development:
0 commit comments