Arduino Mega2560, IDE 1.0
Before:
Origianlly the loop() includes the syntax of reading a numbers of analog input pin, and do some calculation
The result will be sent to computer through serialEvent() function
I sent one character, Arduino report the value immediately for one time
Everything works fine
After:
loop() changed to call two different functions
The first one was those measurement and calculation syntax mentioned above
the second one will first enable some external relays, entered a while loop, and then disable the relays
Problem:
During the while loop
sending one character will first have no respond,then one set of information will be received from Arduino once the while loop was ended
sending N character will first have no respond, then N set of information will be received from Arduino once the while loop was ended
serialEvent should be based on interrupt, and I wonder why a while loop will delay the serialEvent function
thanks