Radio code (sound and Arduino)

good, and your chinese ( processing fu ) is much better now.

but may i suggest
+add+ diagnostic print disable:

boolean diagp = false;

void serialEvent(Serial port){
    String serialStr = port.readStringUntil('\n');
    serialStr=trim(serialStr);
    if ( diagp ) println(serialStr);     // this shows the RAW data ( and the usual timeout "null" )
    int values[]=int(split(serialStr,','));
    if ( diagp ) println(" how long "+values.length);  // this shows if the following == 2 makes any sense
    if(values.length > 0 ){  // keep it open for later improvements
     if ( diagp) printArray(values);   // this shows where possible data end up
      value=values[0];
      println(value);
    }
}

and thanks for sharing the running code.

1 Like