Right now I have my arduino uno setup to serially print 64 numbers in a 16Lx4H configuration each separated by a "|" (The numbers are values from a temperature sensor). I also have the sketch wait for a serial input (the letter S) before outputting all the values. If i upload the sketch, open serial monitor, everything works fine. I type in "S" at the top of the serial monitor, send it, and I see my 64 values. If i input anything else, i get nothing as expected.
Now in mathematica (on a raspberry pi) I open the serial connection using this mathematica command:
serial = DeviceOpen["Serial", {"/dev/ttyACM1", "BaudRate" -> 9600}]. The baudrate is correct to what i have in void setup(). once it's connected, If i try to send the "S" through Mathematica's DeviceWriteBuffer command, the Arduino IDE Serial monitor will show a bunch of numbers with oddly placed decimals and "|"s. Also it is nowhere near 64 values, more like 20 characters total. If I go back to the Serial Monitor and try to send an "S" at the top, i get the same funky results. I've reset the arduino, closed and reopened the IDE/serial monitor, nothing changes. I still get weird values. If i try to reupload the same sketch, it will tell me there was a problem (avrdude : stk500_recv(): programmer is not responding). The only solution now is to disconnect the arduino and reconnect it physically, then i can reupload the same code.
This time I reuploaded the code, created the serial connection but did not send anything through mathematica. In the serial monitor, i tried to send an "S" and got the same weird output.
So sorry for the long read, but I have come to the conclusion that there is something going on with the serial interface when I set it up in Mathematica. I do not understand why because if i did a simpler program such as the one described here (Reading potentiometer values through your Arduino with your Raspberry Pi - Online Technical Discussion Groups—Wolfram Community) I never get weird values.
Does anybody know what is going on? Thanks