I am looking to utilize Pin 13 and an external LED to flicker as either the Rx or Tx LEDs do when Serial data is transferred through the Arduino. The existing code is all in real time to function with external buttons, so there can't be any delay.
I came across this link which seems useful, but I can't quite get it to read from Serial:
http://arduino.cc/en/Tutorial/BlinkWithoutDelay
Thanks in Advance
1 Answer 1
If you are going to use an external LED, then using software to make the LED blink when the RX or TX line is busy is a waste of your CPU.
Instead, simply connect the LED to the RX or TX line using a transistor as a buffer to prevent the current draw from messing with the serial signal.
To borrow an image from this answer to a similar question:
enter image description here
You can try omitting the transistor buffer, but the serial waveform will be altered, possibly to the point where data becomes corrupted. The transistor prevents the current draw of the LED and resistor from loading down the RX or TX lines.
delay(ms);
and other blocking code, and not "must happen the exact same moment" correct?