Advertisement
Guest User

arduino serial echo example

a guest
Oct 16th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. //arduino serial echo example
  2.  
  3. char inByte = 0;         // incoming serial byte
  4.  
  5. void setup()
  6. {
  7.   // start serial port at 9600 bps:
  8.   Serial.begin(9600);
  9. }
  10.  
  11. void loop()
  12. {
  13.   // if we get a valid byte:
  14.   if (Serial.available() > 0)
  15.   {
  16.     // get incoming byte:
  17.     inByte = Serial.read();
  18.  
  19.     // send incoming byte back to serial:
  20.     Serial.print(inByte);
  21.   }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement