donkeyahoy
Well-known member
Hi. I would like to share this really great library and also need some help with software problems. It is called ResponsiveAnalogRead and is used for eliminating noise in analogRead inputs without decreasing responsiveness. The theory and formulas look really impressive and would work great for eliminating noise in potentiometer reading and also filtering out that last place number jitter that always happens. Here it is :
https://github.com/dxinteractive/ResponsiveAnalogRead#analog-resolution
http://damienclarke.me/code/posts/writing-a-better-noise-reducing-analogread
I am having some code trouble though. If you are interested, let me know if you can get it to work correctly. I'm using a Teensy 3.1 with IDE Arduino 1.6.11 Teensyduino 1.30. 10k potentiometer hooked up to the 3.3V and AGND with center wiper into pin A4.
My problems are :
1) Serial.print(analog.getRawValue()); always prints 0
2) Serial.print(analog.getValue()); only prints values of 1 to 1022. I would like it to be 0 to 1023.
3) I can't get it to operate at higher bits than 10. analog.setAnalogResolution(12); only prints getValue() of 1 to 11.
Let me know if you experience the same problems. This library looks promising. Thanks!
https://github.com/dxinteractive/ResponsiveAnalogRead#analog-resolution
http://damienclarke.me/code/posts/writing-a-better-noise-reducing-analogread
I am having some code trouble though. If you are interested, let me know if you can get it to work correctly. I'm using a Teensy 3.1 with IDE Arduino 1.6.11 Teensyduino 1.30. 10k potentiometer hooked up to the 3.3V and AGND with center wiper into pin A4.
My problems are :
1) Serial.print(analog.getRawValue()); always prints 0
2) Serial.print(analog.getValue()); only prints values of 1 to 1022. I would like it to be 0 to 1023.
3) I can't get it to operate at higher bits than 10. analog.setAnalogResolution(12); only prints getValue() of 1 to 11.
Let me know if you experience the same problems. This library looks promising. Thanks!
PHP:
// include the ResponsiveAnalogRead library
#include <ResponsiveAnalogRead.h>
// define the pin you want to use
const int ANALOG_PIN = A4;
// make a ResponsiveAnalogRead object, pass in the pin, and either true or false depending on if you want sleep enabled
// enabling sleep will cause values to take less time to stop changing and potentially stop changing more abruptly,
// where as disabling sleep will cause values to ease into their correct position smoothly and with slightly greater accuracy
ResponsiveAnalogRead analog(ANALOG_PIN, true);
// the next optional argument is snapMultiplier, which is set to 0.01 by default
// you can pass it a value from 0 to 1 that controls the amount of easing
// increase this to lessen the amount of easing (such as 0.1) and make the responsive values more responsive
// but doing so may cause more noise to seep through if sleep is not enabled
void setup() {
// begin serial so we can see analog read values through the serial monitor
Serial.begin(9600);
}
void loop() {
// update the ResponsiveAnalogRead object every loop
analog.update();
Serial.print(analog.getRawValue());
Serial.print("\t");
Serial.print(analog.getValue());
// if the repsonsive value has change, print out 'changed'
if(analog.hasChanged()) {
Serial.print("\tchanged");
}
Serial.println("");
delay(20);
}