Hi,
i have been making a drums for use with the pc but im having trouble with the code - when i trigger the pieso it writes the letter 10-15 times
int ledPin = 13;
byte val = 0;
int statePin = LOW;
int THRESHOLD = 50; // if it's too sensitive then change this value
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
val = analogRead(A0);
if (val >= THRESHOLD) { // check the piezo
Keyboard.println("A");
}
delay (10 );
}
I am guessing i have to limit the time in which it reads that "val" is above the THRESHOLD , or maybe somehow implement the fallingEdge function.
Any ideas are highly appreciated!! Thanks
i have been making a drums for use with the pc but im having trouble with the code - when i trigger the pieso it writes the letter 10-15 times
int ledPin = 13;
byte val = 0;
int statePin = LOW;
int THRESHOLD = 50; // if it's too sensitive then change this value
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
val = analogRead(A0);
if (val >= THRESHOLD) { // check the piezo
Keyboard.println("A");
}
delay (10 );
}
I am guessing i have to limit the time in which it reads that "val" is above the THRESHOLD , or maybe somehow implement the fallingEdge function.
Any ideas are highly appreciated!! Thanks