Using multiple "Serial" ports of arduino mega 2560

조회 수: 21 (최근 30일)
Naim Uddin
Naim Uddin 2020년 3월 10일
댓글: Naim Uddin 2022년 1월 6일
How to read data from Arduino Mega which is already connected with a sensor serially (For exmaple :Tx2/Rx2 or Tx3/Rx3)?
  댓글 수: 1
Ameer Hamza
Ameer Hamza 2020년 3월 10일
Which Serial port is connected to the sensor? Serial0? If not, then you can connect the Arduino to the PC with USB and read data from the serial port.

댓글을 달려면 로그인하십시오.

채택된 답변

Gayatri Menon
Gayatri Menon 2022년 1월 4일
Hi,
In MATLAB,
use device() to connect to serial device on Arduino
arduinoObj = arduino("COM16","Leonardo","Libraries",{'SPI','Serial','I2C'})
% For accessing TX2/RX2
serialdevObj = device(arduinoObj,'SerialPort',2)
write(serialdevObj,[88 99 65]);
Refer the following links for more info
In Simulink ,
use Serial Transmit and Serial Receive blocks to connect serial device on Arduino
The following examples might be helpful for you
Thanks
Gayatri

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by