Read data from multiple analog inputs via Arduino-Computer serial link

3 Ansichten (letzte 30 Tage)
I've configured the serialRunOnArduino and serialRunOnPC models to allow me to record data from an analog sensor on pin A0 of an Arduino Mega. However, I need to read data from two analog sensors, plot separately and save data to the workspace.
I'm struggling to do this so any help would be appreciated.
Here are some screenshots of the serial link models as it stands, including my attempt to add a second serial transmit block.
Best,
Jon

Akzeptierte Antwort

Milton
Milton am 12 Jan. 2018
If you are using two serial output on Mega, then TX0/RX0 and TX1/RX1 are used.
You can check the schematic of Mega. You will find TX0/RX0(PE1/PE0) are connected to USB.
Thus, you will find TX1/RX1 are Pin 18&19. You need to connect this to PI to a TTL to USB board so that you computer can read.
If you just want to use the existing USB from Mega, you need to 'Byte Pack' block to packet two signal together then send it out. From you PC part, you will use 'Byte Unpack' to separate this two signal.
These two blocks are introduced in R2016b

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by