v trigger and arduino code

r00n

Member
Howdy

I am attempting to use the teensy 3.6 to create some rhythms that will sound on voltage triggers.

When a HIGH on the input pin the drum1.noteOn(); does the trick.

I have a problem that I am certain that is answered already. As teensy keeps void looping();, it keeps sensing a high trigger when the trigger length is a longer gate and the duty cycle is a bit larger. Hence the drum1.noteOn(); keeps sounding off and spoiling the sound. The delay(); function here is useless as then some triggers are missed. I notice there is no drum1.noteOff(); in this class.

I hope you understand my problem and thanks for your help.

With Kindness,

roon.
 
Instead of sensing when the input is HIGH, you need to sense when it CHANGEs from HIGH to LOW or from LOW to HIGH.
Post your code (in code tags please - use the </> icon)

Pete
 
I notice there is no drum1.noteOff(); in this class.
I'm wondering what library you are actually using. Ah, I think you are using the AudioSynthSimpleDrum class from the Audio library.
Like Pete said, please post your code.

Paul
 
Last edited:
Code:
void loop() {
 drum1.frequency(map(analogRead(pot1pin),0,1023,20,150));

   if (digitalRead(drumPin1) == HIGH)
    drum1.noteOn();
  }

So it appears that the trigger is just like a button and i have to debounce it, in a way. I think i can do that. Thanks gentlemen.
 
Back
Top