Go Down

Topic: [Solved] Ascii Table Program (Read 622 times) previous topic - next topic

DavidBear2

Jan 08, 2009, 07:06 am Last Edit: Jan 09, 2009, 03:57 am by davidbear1961 Reason: 1
Hi,

I'm a newbee at Arduino, and I just got my Duemilanove.  I followed the getting started instructions, downloaded the 0012 Alpha software package, got the USB recognized by windows (yea!), found the USB port, told the IDE that I have a Diecimila, uploaded Blink, the light flashed, I then modified the program to give random flashes, it worked also (yea! again).  NEXT, I uploaded the example program Ascii Table, saw the Rx/Tx lights flash and then nothing.  I then added the Blink code to the Ascii Table code and saw a blinking LED, but no Ascii Table.  The blinking stopped as it was supposed to when the number got to 126.  Where is the Ascii Table supposed to show up?  I assume that it is supposed to show up in the IDE below the sketch pad.
Quote


// ASCII Table
// by Nicholas Zambetti  

#include "WProgram.h"
void setup();
void loop();
int ledPin = 13;                // LED connected to digital pin 13

void setup()
{
 pinMode(ledPin, OUTPUT);      // sets the digital pin as output
 Serial.begin(4800);
 
 // 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()
{
 digitalWrite(ledPin, HIGH);   // sets the LED on
 delay(1000);                  // waits for a second
 digitalWrite(ledPin, LOW);    // sets the LED off
 delay(1000);                  // waits for a second
 
 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
}





AlphaBeta

#1
Jan 08, 2009, 07:18 am Last Edit: Jan 08, 2009, 07:20 am by AlphaBeta Reason: 1
You are correct about the location as of where to expect the ascii/serial. But you'll need to hit the serial monitor button (the rightmost button in the arduino IDE):


DavidBear2


Go Up