Trigger sound when data == x

i don’t think so,
YOUR program action happens in the

void serialEvent(Serial myPort) {}

so not worry.


for the arduino communication, if you not show the code there,
minimal you should post the

println(myString);

best after a NOT NULL check.


but you do a

 if (values.length > 0) {

later, in where you do your data evaluation,
sadly the JOB

  if (int (v0)==0) snare.trigger();
   if (int (v1)==0) snare.trigger();

you do AFTER the related }
think what that means: you (retrigger) after ( as long as ) a

int (v0)==0

every time also when serial event sees a empty line… ( happens often…)

( no idea how MINIM deals with it )

so, better move that } down, after the two if’s.


just for understanding, what data arduino sends?
Ain’s are int 1023
but you get float 2774 .0 ?
and why you map down to 36?
and if you need int 36 anyhow why not use

int v0 = (int)map(values[0], 0, 2774, 0, 36);

for me your code means:

if ( values[0] < 77.0 )  snare.trigger();

is that what you need?