/* GlobalHello
Echos a char value sent via USB input back to the terminal application.
Initializes returning first keypress as identifier string.
*/
const char* global_hello = "ARDUINO";
int charVal;
void setup() {
Serial.begin(9600);
splash();
}
void splash(){
while (!Serial.available()){
}
Serial.println(global_hello);
}
void loop() {
if (Serial.available()){
charVal = Serial.read();
}
if (charVal){
digitalWrite(13, HIGH); // set LED on
delay(5); // wait
Serial.write(charVal);
Serial.write(32); // space to obviate TX emanation
charVal = 0;
digitalWrite(13, LOW); // set LED off
delay(5); // wait
}
}
Nice echo program, is there any question involved? //otherwise you better posted it in exhibition section
Tip for expanding, let the LED blink the char in morse or #times the ascii value represents
YEP,, THX,
It can be improved into a useful development/debug component, modified and retained. The splash is useful, responds to single key-press in the VB terminal.
It works well with a VB-compiled terminal I use as basis for configuration via USB.