I am using my arduino as a hardware-in-the-loop (HIL) simulation along with simulink. Right now what I am trying to is to serially transmit a matrix with decimal elements to my arduino, have the arduino perform some simple computations and return the decimal value.
This is the code that I am using for my arduino to receive the data:
#include <MatrixMath.h>
float incomingbyte;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if(Serial.available()>0){
incomingbyte = Serial.read();
}
Serial.write(incomingbyte*2);
delay(1000);
}
Which always gives me the following error:
exit status 1
call of overloaded 'write(float)' is ambiguous
The simulink diagram that I have done up is as shown:
I have noticed that only sending uint8 through the serial port works, I have tried not converting the numbers to uint8 before sending and basically nothing happens.
Are there any ways to transmit a matrix with decimal elements?
Thanks.