Grumpy_Mike made a mistake in that
Grumpy Mike dis what it said in the example code. He was perfectly aware that this was crap as soon as the results came out.
When you write a library it is vital that the example codes is accurate. So when there is a line that says:-
int bits_of_precision = 16; //must be a value between 10 and 21
That is what you do.
There was absolutely no comment in the line:-
Serial.print(5.0*analog_reading/MAX_READING_16_bit,5); //display up to 5 digits of precision
Saying that this had to be changed.
So this is a fault in documentation, that is what I was pointing out.
Like any library, to use it correctly you must carefully read the examples and use the library appropriately.
No, the examples must be crystal clear.
As I said before it is a very poor implementation of a library:-
- You can not change the input port
- Global variables are used to pass data out of the library
- Global variables are used to set parameters and process results.
The point about a library is that it should be easy to use. Having to know how it works and manipulating several variables outside the library defeats the object of having one.
The library should have:-
- A call to set the resolution
- Include the port number in the call to do the digitising
- The call should return the float value of the voltage
Study other quality libraries.