Reading three signals on Simulink sent serially to arduino

1 view (last 30 days)
I am sending three signals from one arduino mega to another using xbees. On the receiving end I am using these signals in a Simulink code to control servo motors. Currently it is set up to read from analog pins without the wireless set up. With the wireless technology the signals are all being sent and received through one serial port. I believe I would need to change the inputs in Simulink to a serial receive block instead of an analog pin block. The problem is the documentation for the serial receive block says you can not assign more than one serial receive block to the same serial port. If anyone has a solution to this it would be greatly appreciated!
receiving arduino code:
int received1;
int received2;
int received3;
void setup() {
Serial.begin(9600);
}
void loop() {
if(Serial.available() )
{
received1, received2, received3 = Serial.read();
}
}

Answers (0)

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!