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
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
A module to simplify and help writing MicroPython programs using the setup()/loop() paradigm.
4
4
5
5
## Commands
6
+
6
7
This module also wraps machine functions in easy-to-use methods
7
8
8
9
### pin_mode(PIN_NUMBER/ID, MODE)
@@ -31,7 +32,6 @@ digital_read('A3')
31
32
32
33
return a value of `1` or `0` depending on the signal attached to the specified pins, for instance a button or a digital sensor.
33
34
34
-
35
35
### digital_write(PIN_NUMBER/ID, VALUE)
36
36
37
37
Writes the digital value (`HIGH|LOW|True|False|1|0`) to the pin with Number or ID specified.
@@ -45,7 +45,6 @@ digital_write('A3', 0)
45
45
46
46
Will set the pin to the specified value.
47
47
48
-
49
48
### analog_read(PIN_NUMBER/ID)
50
49
51
50
Reads the analog value for the Voltage applied to the pinpin with Number or ID specified.
@@ -75,7 +74,7 @@ analog_write('A3', 64)
75
74
Will generate a modulated signal on the specified Pin.
76
75
Can be used to control small motors with low current needs as well as servo motors.
77
76
78
-
#### IMPORTANT:
77
+
#### IMPORTANT
79
78
80
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.
81
80
A `ValueError` exception with label "invalid pin" is thrown if the pin number or ID is not valid.
@@ -85,7 +84,6 @@ A `ValueError` exception with label "invalid pin" is thrown if the pin number or
85
84
Will halt the execution of your program for the amount of _milliseconds_ specified in the parameter.
86
85
It is to be considered a code-blocking command.
87
86
88
-
89
87
## Usage
90
88
91
89
The structure of an Arduino MicroPython program will look as follows:
@@ -134,9 +132,11 @@ This brings the implemented runtime commands to the three described below
134
132
Is run _once_ and should contain initialisation code.
135
133
136
134
### loop()
135
+
137
136
Is run indefinitely until the program stops.
138
137
139
138
### cleanup()
139
+
140
140
Is run _once_ when the program stops.
141
141
It should contain code such as resetting the value of variables, stopping timers, causing threads to stop running.
142
142
@@ -161,6 +161,7 @@ start(setup, loop)
161
161
## Utilities
162
162
163
163
Some utility methods are provided and are still in development:
164
+
164
165
*`map(x, in_min, in_max, out_min, out_max)`
165
166
will remap the value `x`from its inputrange to an output range
166
167
*`mapi(x, in_min, in_max, out_min, out_max)`
@@ -187,4 +188,3 @@ create_sketch('main')
187
188
188
189
If the destination `.py`file exists, a timestamp in _microseconds_ will be appended to the name.
0 commit comments