ASCII Table
Demonstrates advanced Arduino serial output functions.
This example demonstrates the advanced serial printing functions by generating on the serial monitor of the Arduino Software (IDE) a table of characters and their ASCII values in decimal, hexadecimal, octal, and binary. For more on ASCII, see asciitable.com and http://en.wikipedia.org/wiki/ASCII
Hardware Required
- Arduino Board
Circuit
None, but the board has to be connected to the computer through the serial port or the USB port.
Code
The sketch waits for a serial connection in the
setup()
then prints line by line the ASCII table up to the last printable character. When this is accomplished, it enters an endless loop in a while structure and nothing else happens. Closing and opening the serial monitor window of the Arduino Software (IDE) should reset the board and restart the sketch.Output
1ASCII Table ~ Character Map2!, dec: 33, hex: 21, oct: 41, bin: 1000013", dec: 34, hex: 22, oct: 42, bin: 1000104#, dec: 35, hex: 23, oct: 43, bin: 1000115$, dec: 36, hex: 24, oct: 44, bin: 1001006%, dec: 37, hex: 25, oct: 45, bin: 1001017&, dec: 38, hex: 26, oct: 46, bin: 1001108', dec: 39, hex: 27, oct: 47, bin: 1001119(, dec: 40, hex: 28, oct: 50, bin: 10100010), dec: 41, hex: 29, oct: 51, bin: 10100111*, dec: 42, hex: 2A, oct: 52, bin: 10101012+, dec: 43, hex: 2B, oct: 53, bin: 10101113,, dec: 44, hex: 2C, oct: 54, bin: 10110014-, dec: 45, hex: 2D, oct: 55, bin: 10110115., dec: 46, hex: 2E, oct: 56, bin: 10111016/, dec: 47, hex: 2F, oct: 57, bin: 101111170, dec: 48, hex: 30, oct: 60, bin: 110000181, dec: 49, hex: 31, oct: 61, bin: 110001192, dec: 50, hex: 32, oct: 62, bin: 110010203, dec: 51, hex: 33, oct: 63, bin: 110011214, dec: 52, hex: 34, oct: 64, bin: 110100225, dec: 53, hex: 35, oct: 65, bin: 110101236, dec: 54, hex: 36, oct: 66, bin: 110110247, dec: 55, hex: 37, oct: 67, bin: 110111258, dec: 56, hex: 38, oct: 70, bin: 111000269, dec: 57, hex: 39, oct: 71, bin: 11100127:, dec: 58, hex: 3A, oct: 72, bin: 11101028;, dec: 59, hex: 3B, oct: 73, bin: 11101129<, dec: 60, hex: 3C, oct: 74, bin: 11110030=, dec: 61, hex: 3D, oct: 75, bin: 11110131>, dec: 62, hex: 3E, oct: 76, bin: 11111032?, dec: 63, hex: 3F, oct: 77, bin: 11111133@, dec: 64, hex: 40, oct: 100, bin: 100000034A, dec: 65, hex: 41, oct: 101, bin: 100000135B, dec: 66, hex: 42, oct: 102, bin: 100001036C, dec: 67, hex: 43, oct: 103, bin: 100001137D, dec: 68, hex: 44, oct: 104, bin: 100010038E, dec: 69, hex: 45, oct: 105, bin: 100010139...
Learn more
You can find more basic tutorials in the built-in examples section.
You can also explore the language reference, a detailed collection of the Arduino programming language.
Last revision 2015/07/28 by SM
Suggest changes
The content on docs.arduino.cc is facilitated through a public GitHub repository. If you see anything wrong, you can edit this page here.
License
The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.