serial port no communication between arduino UNO and max9
hello,
I'm struggling with serial object.
I opened an old project of mine (made in max8) to run emg sensor data to max from arduino, and now I can't connect to the specific port as I used to back in the days (2022).
I'm running out of ideas about how to sort this issue out. Besides upgrading to max9, I also update OS since then.
Here's a short about what I did in 2022.
here's my arduino code (perhaps I'm missing something):
void setup() {
// initialize serial comm at 115200 bits per second
Serial.begin(115200);
}
void loop() {
// read the input on analog pin 0
int emgSensor = analogRead(A0);
//print out the value you are reading
Serial.println(emgSensor);
delay(1); // delay in between reads for stability
}
and here my max patch:
any ideas?
best,
well, I sorted it out.
It looks like weird black magic, but here's what I did
1) connect arduino
2) load the patch, stablish communication with port (accordingly to print)
3) open arduino IDE, load the code into the UNO
I notice (and here's the weird black magic) that if you open the monitor on the IDE it blocks the communication with the serial port in max, if you closed it, it sends again.
delirium tremes,
best,
beside that black magic - which is known rule for serial devices,
you have few issues in that patch.
zl objects have default list size of 256.
using zl.stream with 750 is not going to output 750 sized list but only 256.
same with zl.median.
By the way zl.median outputs middle of the list found result,
and not average value.
you should rather average readings in arduino, to avoid serial data
flood.
You send in 1ms interval, but read port in max using metro 53 ?
I'd even smooth myself on Arduino itself (running mean could be easy there)
code & patch, besides the list length 256 thing, seem to be very correct.
Yes, when you have an application consuming a specific serial port, often, systems lock that from being used by other applications.