This example demonstrates string-based communication from the Arduino board to the computer using a call-and-response (handshaking) method. The sketch sends an ASCII string on startup and repeats that until it gets a serial response from the computer. Then it sends three sensor values as ASCII-encoded numbers, separated by commas and terminated by a linefeed and […]
Projects
Serial Call and Response using Arduino
This example demonstrates multi-byte communication from the Arduino board to the computer using a call-and-response (handshaking) method. This sketch sends an ASCII A (byte of value 65) on startup and repeats that until it gets a serial response from the computer. Then it sends three sensor values as single bytes, and waits for another response […]
Virtual Color Mixer using Arduino
This example demonstrates how to send multiple values from the Arduino board to the computer. The readings from three potentiometers are used to set the red, green, and blue components of the background color of a Processing sketch or Max/MSP patch. Software Required Processing or Max/MSP version 5 Circuit Connect analog sensors to analog input pins […]
Arduino based Graph
This example shows you how to send a byte of data from the Arduino to a personal computer and graph the result. This is called serial communication because the connection appears to both the Arduino and the computer as a serial port, even though it may actually use a USB cable. You can use the […]
Dimmer using an Arduino
This example shows how to send data from a personal computer to an Arduino board to control the brightness of an LED. The data is sent in individual bytes, each of which ranges in value from 0 to 255. Arduino reads these bytes and uses them to set the brightness of the LED. You can […]
ASCII Table using Arduino
Demonstrates the advanced serial printing functions by generating a table of characters and their ASCII values in decimal, hexadecimal, octal, and binary. For more on ASCII, see asciitable.com Circuit image developed using Fritzing. For more circuit examples, see the Fritzing project page None, but the Arduino has to be connected to the computer. Code /* ASCII table Prints […]
Read ASCII String using Arduino
This sketch uses the Serial.parseInt() function to locate values separated by a non-alphanumeric character. Often people use a comma to indicate different pieces of information (this format is commonly referred to as comma-separated-values), but other characters like a space or a period will work too. The values are parsed into ints and used to determine the color […]
Fading using an Arduino
Demonstrates the use of analog output (Pulse Width Modulation (PWM)) to fade an LED. PWM is a technique for getting an analog-like behavior from a digital output by switching it off and on very fast. Circuit An LED connected to digital output pin 9 through a 220-ohm resistor. Schematic image developed using Fritzing. For more circuit […]
Calibrating sensor input using Arduino
This example demonstrates one techinque for calibrating sensor input. The Arduino takes sensor readings for five seconds during the startup, and tracks the highest and lowest values it gets. These sensor readings during the first five seconds of the sketch execution define the minimum and maximum of expected values for the readings taken during the […]
Analog Write with 12 LEDs on an Arduino Mega
This example fades 12 LEDs up and the down, one by one, on an Arduino Mega board. Circuit image developed using Fritzing. For more circuit examples, see the Fritzing project page Connect the longer, positive legs of (anodes) 12 LEDs to digital pins 2-13 through 220 ohm current limiting resistors. Connect the shorter, negative legs (cathodes) to ground. Schematic Code In […]
