eChO.cpp
Another example of traditional byte-by-byte serial communications. This sketch opens the NorthFace for traditional serial at 57600 baud 8N1, and just echoes back everything it reads -- except every other alphabetic charater has iT's CaSe InVeRtEd. so We CaN eAsIlY tElL tHaT iT's WoRkInG.
void setup() {
NorthFace.begin(57600);
}
bool flipCase = false;
void loop() {
int ch;
ch = NorthFace.read();
if (ch >= 0) {
if ((ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z')) {
flipCase = !flipCase;
if (flipCase)
ch ^= 0x20;
}
NorthFace.print(ch,BYTE);
}
}