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

Arduino 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);

Major Components in Project

Hardware Required

  • Arduino Board
For more detail: ASCII Table using Arduino




This Post / Project can also be found using search terms:

  • arduino ascii
  • arduino ascii table change values
  • write ascii code on arduino
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
A Simple and Very Easy Inverted Pendulum Balancing Robot
A Simple and Very Easy Inverted Pendulum Balancing Robot

Let's make a simple inverted balancing robot, and operate it. You need only half a day to do them, if...

Close
Scroll to top