// Echo sketch, inverting capitalization of alternate alphabetics void setup() { NorthFace.begin(57600); // Start traditional serial on North at 57600 baud 8N1 } bool flipCase = false; // A variable to remember if we should change case void loop() { int ch; ch = NorthFace.read(); // Returns -1 if no input if (ch >= 0) { // Got something! if ((ch >= 'a' && ch <= 'z') || // If ch is a lowercase alphabetic, or.. (ch >= 'A' && ch <= 'Z')) { // ..an uppercase alphabetic flipCase = !flipCase; // Toggle our 'state variable' if (flipCase) // If we should case-flip this alphabetic character.. ch ^= 0x20; // Wow! Inverts case by flipping one bit! } NorthFace.print(ch,BYTE); // Echo back (possibly modified) character } }