Go Down

Topic: "global hello" (Read 1 time) previous topic - next topic

boinerz

May 17, 2013, 12:33 am Last Edit: May 17, 2013, 12:43 am by boinerz Reason: 1
Code: [Select]

/* 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
    }
 }

 

robtillaart


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
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

boinerz

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.

Go Up