Hello
I'm using an Arduino Pro Micro to send Midi notes when triggered by a piezo sensor.
When I'm connecting the piezo only with a defined threshold, everything works great.
(My analog input reads 0 when nothing is hit, and approx 400 when hit)
But when i'm connecting a potentiometer to adjust the threshold manually, my piezo analog input is never equal to 0 anymore, but always around 25% of the potentiometer value...
Why is that?
Am i supposed to add other components to "cancel" the potentiometer value ?
Here is my wiring :
And my code
#include <MIDIUSB.h>
const int potentiometer = A0;
const int piezotrigger1 = A1;
void setup() {
Serial.begin(9600); //debug
pinMode(piezotrigger1, INPUT);
}
void loop() {
int potentiometerValue = analogRead(potentiometer);
int piezo1Value = analogRead(piezotrigger1) * 100;
Serial.println(potentiometerValue);
Serial.println(piezo1Value);
if (piezo1Value > 250) {
noteOn(0, 60, 127);
MidiUSB.flush();
noteOff(0, 60, 0);
delay(100);
}
}
Thank you all very much for your help,