I need to get the datato arduino Mega from Three boards which are running independently.
all the collected data will be shown on the serial monitor using Arduino mega.
Can I do this using SerialEvent() function
Arduino mega has SerialEvent() for Three Serial Ports.
which serial will it choose when Two Serials Receive the data at the same time?
SerialEvent() is called when there is data available.
if the program is in the process of handling/parsing the first serial message, will it interrupt/abandon this process as soon as another SerialEvent on another port is triggered? Or will it complete the first SerialEvent routine before going to the second one?
AWOL:
No, it is called every time through the infinite loop in "main()"
I know i am not expert here.. But the reference says it...
serialEvent()
Description
Called when data is available. Use Serial.read() to capture this data.
UKHeliBob:
Answer: Don't use SerialEvent. Check for available serial data using Serial.available(), Serial1.available() and Serial2.available()
On the mega you could use SerialEvent, SerialEvent1 and SerialEvent2 but why bother ?
like I said how can I handle if two serials receive data at the same time...
I dont know it may be stupid question..
I think when ever there is data in Serial Buffer It will automatically send to the buffer right..?
so when it receiving in three serials at the same time does it store the all data in all three buffers?
Sorry, the point I was trying to make (badly) was that the reference seems to imply that SerialEvent is called as soon as data becomes available, which is just not the case.