serial problems using a Daisy

jmejia@gmail.com's icon

I'm testing with this very simple code on a daisy seed - using the daisyduino environment.


void setup(){
Serial.begin(9600);
}
void loop()
{
Serial.println(random(0, 250));
delay(10);
}

I'm able to see the random numbers in the arduino serial monitor, closing Arduino I'm also able to receive them just fine in Processing using this example code: https://processing.org/reference/libraries/serial/Serial_readBytes_.html

But ensuring that Processing and Arduino are closed, I mostly don't see anything in Max. Occasionally after resetting objects and restarting polling a single byte comes through - but usually nothing. I'm using a print message into serial to get the right letter name for my port, and I'm polling with metro. I know I need to convert from byte to int - but I'm not even seeing the bytes come through with this test patch:

serial-test-simple.maxpat
text/plain 3.13 KB

I suspect this may have something to do with the serial emulator/driver the daisy uses - but it feels like a Max bug because all the other serial monitors I try don't have this issue.

Sébastien Gay's icon

MAX cannot simply use the "raw" message sent by Arduino :
1. Serial.println instruction is coded as a "13".
2. the number generated by random(0,250) is coded by something different from "13" (and "10", which corresponds to Serial.print() ).

The MAX code consists in truncating incoming data each time a 13 is received and converting anything else to numbers.

You must close Arduino IDE before switching [metro] on.