SerialEvent

This example demonstrates use of the serialEvent() function. This function is automatically called at the end of loop() when there is serial data available in the buffer. In this case, each character found is added to a string until a newline is found. Then the string is printed and set back to null.

Hardware Required

  • Arduino Board

Circuit

circuit

None, but the board has to be connected to the computer; the Arduino Software (IDE) serial monitor may be used to communicate the single or multiple characters and receive the string back.

Code

See Also

  • serialEvent()

  • ASCIITable - Demonstrates Arduino's advanced serial output functions.

  • Dimmer - Move the mouse to change the brightness of an LED.

  • Graph - Send data to the computer and graph it in Processing.

  • Midi - Send MIDI note messages serially.

  • MultiSerialMega - Use two of the serial ports available on the Arduino Mega.

  • PhysicalPixel - Turn a LED on and off by sending data to your board from Processing or Max/MSP.

  • ReadASCIIString - Parse a comma-separated string of integers to fade an LED.

  • SerialCallResponse - Send multiple variables using a call-and-response (handshaking) method.

  • SerialCallResponseASCII - Send multiple variables using a call-and-response (handshaking) method, and ASCII-encode the values before sending.

  • VirtualColorMixer - Send multiple variables from Arduino to your computer and read them in Processing or Max/MSP.

Last revision 2015/07/29 by SM