Tutorial.ASCIITable History

Hide minor edits - Show changes to markup

January 07, 2013, at 04:57 PM by Roberto Guido -
Changed lines 12-14 from:
to:
 https://raw.github.com/arduino/Arduino/master/build/shared/examples/04.Communication/ASCIITable/ASCIITable.ino
January 07, 2013, at 04:51 PM by Roberto Guido -
Changed lines 12-14 from:
to:
June 04, 2010, at 10:08 AM by Equipo Traduccion -
Changed lines 1-11 from:

Examples > Communication

ASCII Table

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

None, but the Arduino has to be connected to the computer.

Code

to:

Ejemplos > Comunicaciones

Tabla ASCII

Muestra las funciones avanzadas de impresión serie mediante la generación de una tabla de caracteres ASCII y sus valores en decimal, hexadecimal, octal y binario. Para más información sobre ASCII, mira http://www.asciitable.com y http://en.wikipedia.org/wiki/ASCII.

Circuito

Ninguno, pero el Arduino tiene que estar conectado al ordenador.

Código

Changed lines 15-16 from:

Output

to:

Salida

Changed lines 18-20 from:

ASCII Table ~ Character Map

, dec: 33, hex: 21, oct: 41, bin

4, decúASCII Table ~ Character Map

to:

Tabla ASCII ~ Mapa de Carácteres

February 23, 2010, at 08:07 PM by Tom Igoe -
Changed lines 12-89 from:
to:
July 05, 2009, at 07:29 PM by Tom Igoe -
Changed lines 12-15 from:

[@ /*

  ASCII table
to:
Changed lines 36-38 from:
 Prints out byte values in all possible formats:  
 * as raw binary values
 * as ASCII-encoded decimal, hex, octal, and binary values
to:
   // prints title with ending line break 
   Serial.println("ASCII Table ~ Character Map"); 
 } 
Changed lines 40-44 from:
 For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
to:
 // 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 = '!';  
Changed lines 46-51 from:
 The circuit:  No external hardware needed.
to:
 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.print(thisByte, BYTE);    
Changed lines 53-56 from:
 created 2006
 by Nicholas Zambetti 
 modified 18 Jan 2009
 by Tom Igoe
to:
   Serial.print(", dec: "); 
   // prints value as string as an ASCII-encoded decimal (base 10).
   // Decimal is the  default format for Serial.print() and Serial.println(),
   // so no modifier is needed:
   Serial.print(thisByte);      
   // But you can declare the modifier for decimal if you want to.
   //this also works if you uncomment it:
Changed lines 61-120 from:
 <http://www.zambetti.com> 
 */

void setup() {

  Serial.begin(9600); 

  // 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.print(thisByte, BYTE);    

  Serial.print(", dec: "); 
  // prints value as string as an ASCII-encoded decimal (base 10).
  // Decimal is the  default format for Serial.print() and Serial.println(),
  // so no modifier is needed:
  Serial.print(thisByte);      
  // But you can declare the modifier for decimal if you want to.
  //this also works if you uncomment it:

  // Serial.print(thisByte, DEC);  

  Serial.print(", hex: "); 
  // prints value as string in hexadecimal (base 16):
  Serial.print(thisByte, HEX);     

  Serial.print(", oct: "); 
  // prints value as string in octal (base 8);
  Serial.print(thisByte, OCT);     

  Serial.print(", bin: "); 
  // prints value as string in binary (base 2) 
  // also prints ending line break:
  Serial.println(thisByte, BIN);   

  // if printed last visible character '~' or 126, stop: 
  if(thisByte == 126) {     // you could also use if (thisByte == '~') {
    // This loop loops forever and does nothing
    while(true) { 
      continue; 
    } 
  } 
  // go on to the next character
  thisByte++;  

}

@]

to:
April 15, 2009, at 10:46 PM by Tom Igoe -
Changed lines 5-6 from:

Demonstrates the advanced serial printing functions by generating a table of characters and their ASCII values in decimal, hexadecimal, octal, and binary.

to:

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

Changed lines 14-22 from:

// ASCII Table // by Nicholas Zambetti <http://www.zambetti.com>

void setup() {

  Serial.begin(9600); 

  // prints title with ending line break 
  Serial.println("ASCII Table ~ Character Map"); 
to:

/*

  ASCII table
Changed lines 17-19 from:
  // wait for the long string to be sent 
  delay(100); 

}

to:
 Prints out byte values in all possible formats:  
 * as raw binary values
 * as ASCII-encoded decimal, hex, octal, and binary values
Changed line 21 from:

int number = 33; // first visible character '!' is #33

to:
 For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
Changed lines 23-32 from:

void loop()

to:
 The circuit:  No external hardware needed.

 created 2006
 by Nicholas Zambetti 
 modified 18 Jan 2009
 by Tom Igoe

 <http://www.zambetti.com> 
 */

void setup()

Changed lines 34-35 from:
  Serial.print(number, BYTE);    // prints value unaltered, first will be '!' 
to:
  Serial.begin(9600); 

  // 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.print(thisByte, BYTE);    
Changed lines 54-56 from:
  Serial.print(number);          // prints value as string in decimal (base 10) 
  // Serial.print(number, DEC);  // this also works 
to:
  // prints value as string as an ASCII-encoded decimal (base 10).
  // Decimal is the  default format for Serial.print() and Serial.println(),
  // so no modifier is needed:
  Serial.print(thisByte);      
  // But you can declare the modifier for decimal if you want to.
  //this also works if you uncomment it:

  // Serial.print(thisByte, DEC);  

Changed lines 65-66 from:
  Serial.print(number, HEX);     // prints value as string in hexadecimal (base 16) 
to:
  // prints value as string in hexadecimal (base 16):
  Serial.print(thisByte, HEX);     
Changed lines 69-70 from:
  Serial.print(number, OCT);     // prints value as string in octal (base 8) 
to:
  // prints value as string in octal (base 8);
  Serial.print(thisByte, OCT);     
Changed lines 73-78 from:
  Serial.println(number, BIN);   // prints value as string in binary (base 2) 
                                 // also prints ending line break 

  // if printed last visible character '~' #126 ... 
  if(number == 126) { 
    // loop forever 
to:
  // prints value as string in binary (base 2) 
  // also prints ending line break:
  Serial.println(thisByte, BIN);   

  // if printed last visible character '~' or 126, stop: 
  if(thisByte == 126) {     // you could also use if (thisByte == '~') {
    // This loop loops forever and does nothing
Changed lines 84-88 from:
  number++; // to the next character 

  delay(100); // allow some time for the Serial data to be sent 

}

to:
  // go on to the next character
  thisByte++;  

}

Added lines 94-95:

, dec: 33, hex: 21, oct: 41, bin

4, decúASCII Table ~ Character Map

Added lines 104-134:

), dec: 41, hex: 29, oct: 51, bin: 101001

  • , dec: 42, hex: 2A, oct: 52, bin: 101010

+, dec: 43, hex: 2B, oct: 53, bin: 101011 ,, dec: 44, hex: 2C, oct: 54, bin: 101100 -, dec: 45, hex: 2D, oct: 55, bin: 101101 ., dec: 46, hex: 2E, oct: 56, bin: 101110 /, dec: 47, hex: 2F, oct: 57, bin: 101111 0, dec: 48, hex: 30, oct: 60, bin: 110000 1, dec: 49, hex: 31, oct: 61, bin: 110001 2, dec: 50, hex: 32, oct: 62, bin: 110010 3, dec: 51, hex: 33, oct: 63, bin: 110011 4, dec: 52, hex: 34, oct: 64, bin: 110100 5, dec: 53, hex: 35, oct: 65, bin: 110101 6, dec: 54, hex: 36, oct: 66, bin: 110110 7, dec: 55, hex: 37, oct: 67, bin: 110111 8, dec: 56, hex: 38, oct: 70, bin: 111000 9, dec: 57, hex: 39, oct: 71, bin: 111001

, dec
58, hex: 3A, oct: 72, bin: 111010

;, dec: 59, hex: 3B, oct: 73, bin: 111011 <, dec: 60, hex: 3C, oct: 74, bin: 111100 =, dec: 61, hex: 3D, oct: 75, bin: 111101 >, dec: 62, hex: 3E, oct: 76, bin: 111110 ?, dec: 63, hex: 3F, oct: 77, bin: 111111 @, dec: 64, hex: 40, oct: 100, bin: 1000000 A, dec: 65, hex: 41, oct: 101, bin: 1000001 B, dec: 66, hex: 42, oct: 102, bin: 1000010 C, dec: 67, hex: 43, oct: 103, bin: 1000011 D, dec: 68, hex: 44, oct: 104, bin: 1000100 E, dec: 69, hex: 45, oct: 105, bin: 1000101

April 11, 2007, at 05:16 PM by David A. Mellis -
Added line 74:

...

Deleted lines 75-76:

...

April 11, 2007, at 05:16 PM by David A. Mellis -
Changed lines 60-76 from:

@]

to:

@]

Output

ASCII Table ~ Character Map
!, dec: 33, hex: 21, oct: 41, bin: 100001
", dec: 34, hex: 22, oct: 42, bin: 100010
#, dec: 35, hex: 23, oct: 43, bin: 100011
$, dec: 36, hex: 24, oct: 44, bin: 100100
%, dec: 37, hex: 25, oct: 45, bin: 100101
&, dec: 38, hex: 26, oct: 46, bin: 100110
', dec: 39, hex: 27, oct: 47, bin: 100111
(, dec: 40, hex: 28, oct: 50, bin: 101000

...

March 26, 2007, at 02:02 PM by David A. Mellis -
Added lines 1-60:

Examples > Communication

ASCII Table

Demonstrates the advanced serial printing functions by generating a table of characters and their ASCII values in decimal, hexadecimal, octal, and binary.

Circuit

None, but the Arduino has to be connected to the computer.

Code

// ASCII Table 
// by Nicholas Zambetti <http://www.zambetti.com> 

void setup() 
{ 
  Serial.begin(9600); 

  // prints title with ending line break 
  Serial.println("ASCII Table ~ Character Map"); 

  // wait for the long string to be sent 
  delay(100); 
} 

int number = 33; // first visible character '!' is #33 

void loop() 
{ 
  Serial.print(number, BYTE);    // prints value unaltered, first will be '!' 

  Serial.print(", dec: "); 
  Serial.print(number);          // prints value as string in decimal (base 10) 
  // Serial.print(number, DEC);  // this also works 

  Serial.print(", hex: "); 
  Serial.print(number, HEX);     // prints value as string in hexadecimal (base 16) 

  Serial.print(", oct: "); 
  Serial.print(number, OCT);     // prints value as string in octal (base 8) 

  Serial.print(", bin: "); 
  Serial.println(number, BIN);   // prints value as string in binary (base 2) 
                                 // also prints ending line break 

  // if printed last visible character '~' #126 ... 
  if(number == 126) { 
    // loop forever 
    while(true) { 
      continue; 
    } 
  } 

  number++; // to the next character 

  delay(100); // allow some time for the Serial data to be sent 
}
 

Share