here'a the code, look familiar?:
/*
Character analysis operators
Examples using the character analysis operators.
Send any byte and the sketch will tell you about it.
created 29 Nov 2010
by Tom Igoe
This example code is in the public domain.
*/
void setup() {
// Open serial communications:
Serial.begin(9600);
// send an intro:
Serial.println("send any byte and I'll tell you everything I can about it");
Serial.println();
}
void loop() {
// get any incoming bytes:
if (Serial.available() > 0) {
int thisChar = Serial.read();
// say what was sent:
Serial.print("You sent me: \'");
Serial.write(thisChar);
Serial.print("\' ASCII Value: ");
Serial.println(thisChar);
// analyze what was sent:
if(isAlphaNumeric(thisChar)) {
Serial.println("it's alphanumeric");
}
if(isAlpha(thisChar)) {
Serial.println("it's alphabetic");
}
if(isAscii(thisChar)) {
Serial.println("it's ASCII");
}
if(isWhitespace(thisChar)) {
Serial.println("it's whitespace");
}
if(isControl(thisChar)) {
Serial.println("it's a control character");
}
if(isDigit(thisChar)) {
Serial.println("it's a numeric digit");
}
if(isGraph(thisChar)) {
Serial.println("it's a printable character that's not whitespace");
}
if(isLowerCase(thisChar)) {
Serial.println("it's lower case");
}
if(isPrintable(thisChar)) {
Serial.println("it's printable");
}
if(isPunct(thisChar)) {
Serial.println("it's punctuation");
}
if(isSpace(thisChar)) {
Serial.println("it's a space character");
}
if(isUpperCase(thisChar)) {
Serial.println("it's upper case");
}
if (isHexadecimalDigit(thisChar)) {
Serial.println("it's a valid hexadecimaldigit (i.e. 0 - 9, a - F, or A - F)");
}
// add some space and ask for another byte:
Serial.println();
Serial.println("Give me another byte:");
Serial.println();
}
}
Exact same thing that comes with the download. After more fussing, I find if i load it to the MEGA 2560 from Ubuntu installation of Arduino 1 IDE, it appears to load but will not run and the "L" led flashes slowly. If i change the board to UNO, and load it same way it works. I thought it might matter WHEN I switched the board selection in the IDE so i went all the way out, then reloaded IDE, switched board to MEGA 2560, and no joy - works with UNO, doesn't with MEGA.
Now we come to the good part. It works fine with either board on the Windows XP Arduino 1.0 IDE installation. AND, if I load it using the Windows IDE, it will run both on Windows and Ubuntu, so it must have something to do with the way the IDE loads the code under Ubuntu - possibly something's messed up in the Ubuntu cores, or ??
So i submit that there is a difference in the way the Ubuntu loader works between the UNO and the MEGA 2560 which matters. If there is a difference between the UNO and MEGA loaders in Windows, it doesn't matter.
I might add that I had the same trouble everyone else has loading new sketches over earlier short sketches on the UNO from Ubuntu until I started putting delay(5000) at the head of the setup. Before i caught on to that, I would have to go to the windows installation, which didn't seem to have this timing interface problem, and load a trivial example, which i could then overwrite in ubuntu.
to summarize, problem could be:
1. UNO and MEGA do not treat USB port same and it matters on Linux but not on pc.
2. Ubuntu loader that works on UNO but not on MEGA has software problem in cores (maybe)?
3. soemthing else related to Ubuntu handling of loading on MEGA.
I'm going to try loading my serious code from Windows next to see if it loads properly.
What does the slow flashing "L" mean?