Summary of ASCII Table using Arduino
The article demonstrates generating an ASCII table using an Arduino by printing characters with their ASCII values in decimal, hexadecimal, octal, and binary formats through advanced serial printing functions. The project requires no external hardware except an Arduino connected to a computer. The code initializes the serial communication, then iterates through ASCII characters starting from 33 ('!'), printing each character’s representation in multiple formats.
Parts used in the ASCII Table Project:
- Arduino Board
- Computer (for serial communication)
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 out byte values in all possible formats:
* as raw binary values
* as ASCII-encoded decimal, hex, octal, and binary values
For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
The circuit: No external hardware needed.
created 2006
by Nicholas Zambetti
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
<http://www.zambetti.com>
*/
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// prints title with ending line break
Serial.println(“ASCII Table ~ Character Map”);
}
// first visible ASCIIcharacter ‘!’ is number 33:
int thisByte = 33;
// you can also write ASCII characters in single quotes.
// for example. ‘!’ is the same as 33, so you could also use this:
//int thisByte = ‘!’;
void loop() {
// prints value unaltered, i.e. the raw binary version of the
// byte. The serial monitor interprets all bytes as
// ASCII, so 33, the first number, will show up as ‘!’
Serial.write(thisByte);
Hardware Required
- Arduino Board