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
analogReadResolution() is an extension of the Analog API for the Arduino Due.
20
+
analogReadResolution() is an extension of the Analog API for the Arduino Due, Zero and MKR Family.
21
21
22
-
Sets the size (in bits) of the value returned by analogRead(). It defaults to 10 bits (returns values between 0-1023) for backward compatibility with AVR based boards.
22
+
Sets the size (in bits) of the value returned by `analogRead()`. It defaults to 10 bits (returns values between 0-1023) for backward compatibility with AVR based boards.
23
23
24
-
The *Due, Zero and MKR Family* boards have 12-bit ADC capabilities that can be accessed by changing the resolution to 12. This will return values from analogRead() between 0 and 4095.
24
+
The *Due, Zero and MKR Family* boards have 12-bit ADC capabilities that can be accessed by changing the resolution to 12. This will return values from `analogRead()` between 0 and 4095.
25
25
[%hardbreaks]
26
26
27
27
@@ -32,7 +32,7 @@ The *Due, Zero and MKR Family* boards have 12-bit ADC capabilities that can be a
32
32
33
33
[float]
34
34
=== Parameters
35
-
`bits`: determines the resolution (in bits) of the value returned by `analogRead()` function. You can set this 1 and 32. You can set resolutions higher than 12 but values returned by `analogRead()` will suffer approximation. See the note below for details.
35
+
`bits`: determines the resolution (in bits) of the value returned by the `analogRead()` function. You can set this between 1 and 32. You can set resolutions higher than 12 but values returned by `analogRead()` will suffer approximation. See the note below for details.
36
36
37
37
[float]
38
38
=== Returns
@@ -82,15 +82,15 @@ void loop() {
82
82
Serial.print(", 8-bit : ");
83
83
Serial.println(analogRead(A0));
84
84
85
-
// a little delay to not hog serial monitor
85
+
// a little delay to not hog Serial Monitor
86
86
delay(100);
87
87
}
88
88
----
89
89
[%hardbreaks]
90
90
91
91
[float]
92
92
=== Notes and Warnings
93
-
If you set the `analogReadResolution()` value to a value higher than your board's capabilities, the Arduino will only report back at its highest resolution padding the extra bits with zeros.
93
+
If you set the `analogReadResolution()` value to a value higher than your board's capabilities, the Arduino will only report back at its highest resolution, padding the extra bits with zeros.
94
94
95
95
For example: using the Due with `analogReadResolution(16)` will give you an approximated 16-bit number with the first 12 bits containing the real ADC reading and the last 4 bits *padded with zeros*.
0 commit comments