serial object not receiving data from Arduino
Hello dear forum,
having a problem with serial
When I send data from Arduino to its IDE all is monitored fine.
But wenn I try to receive it in max via the serial object, I don't receive any data
what I already tried:
- printing serial port (the only thing that worked)
- all max documentation and tutorials within max that I could find (don't work because serial doesn't receive any data)
- either running IDE and or max, but not both at once (problem remained)
- all max/arduino tutorials I could find on the internet (didn't solve my problem)
even though the serial object prints out the port, when I send a message "print" to it, I still can't receive any data from the serial object. I tried all Max code snippets for that which I could find in this forum, but I get the same result: no incoming messages, no matter what.
Could there be a problem with my security
Max8.5.2
system: Max M1 chip
Arduino Uno Wifi Rev2
Max Code:
Arduino Code:
int val[6]; //Array. 6 sensors total
void setup() {
Serial.begin(9600); // Serial communication set up
}
void loop() {
//Read analog inputs one by one and send them to MaxMSP
for(int i = 0; i < 6; i++){
val[i] = analogRead(i);
Serial.print(val[i]);
Serial.print(" ");
}
Serial.println();
delay(10);
}
I have the same problem with the Arduino Uno Wifi Rev2.
But...You need to send an [open] message to the serial object. However then still it doesn't work as aspected.
The only way works (for me) is when i poll the serial open it in Max and then open and close the serial monitor in de Arduino IDE.
This must be a bug...? cause the same code with a regular Uno is working just fine.
Mac M1 Max.
Max 8.5.3
Arduino Uno Wifi Rev2
Arduino IDE 2.0.4
Okay... I believe I have found a solution. It seems that you need to set the DTR enable (data Terminal Ready) flag to 1 in the serial object. For me this solved the connection problems.
Hi Marker,
many thanks for your replies. I actually bought then an Arduino Uno and the code and everything else worked just fine. I'll try that again with my Wifi Rev2 as soon as I get back to my project in May...
Best,
El
I'm so glad I found this post! I was tearing (what's left of) my hair out trying to figure this out. Worked fine with an Arduino UNO, but with several other microcontrollers (Adafruit ItsyBitsy M4, NeoTrellis M4, Pico W) Max failed to read the serial port until I opened and closed the Arduino Serial Monitor.