why the range of the output is from 0 - 4088 for analogSetWidth(9)?
Posted: Wed Jun 22, 2022 5:13 am
in the official docs, it shows:
anything wrong to my code?
[Codebox]
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
2696
2688
2688
2680
2688
2688
2680
2672
2680
2672
2672
2672
2672
2672
2672
2664
2664
2664
2656
2656
728
728
720
728
728
728
728
720
720
720
720
712
712
712
712
704
704
704
704
696
696
696
696
696
688
[/Codebox]
anyhow, it seems to me that the range of the output doesn't change, no matter what the parameter is, 9,10,11,12. why?analogSetWidth¶
This function is used to set the hardware sample bits and read resolution. Default is 12bit (0 - 4095). Range is 9 - 12.
anything wrong to my code?
- #include <Arduino.h>
- void setup() {
- Serial.begin(9600);
- pinMode(A3, INPUT);
- analogSetWidth(9);
- }
- void loop() {
- Serial.println(analogRead(A3));
- }
[Codebox]
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
4088
2696
2688
2688
2680
2688
2688
2680
2672
2680
2672
2672
2672
2672
2672
2672
2664
2664
2664
2656
2656
728
728
720
728
728
728
728
720
720
720
720
712
712
712
712
704
704
704
704
696
696
696
696
696
688
[/Codebox]