I'm trying to send some data from Matlab to Arduino,but I'm not receiving what I expect, when I send a '5' in a double-variable, I receive the character 'e' at the Arduino Terminal.
The Arduino code is:
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available())
{
Serial.write(Serial.read());
}
}
And the matlab code is:
data=5
PS=serial('COM11','BaudRate',9600);
fopen(PS);
fwrite(PS,data)
fclose(PS);
delete(PS);
clear PS;
Serial.write(Serial.read());
this sends back exactly what you receive, so it's not really helpful to find out what you received.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.