Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. char val; // variable to receive data from the serial port
  2. void setup() {
  3. // put your setup code here, to run once:
  4. Serial.begin(9600); // start serial communication at 9600bps
  5. }
  6.  
  7. void loop() {
  8. // put your main code here, to run repeatedly:
  9.  
  10. if( Serial.available() ) // if data is available to read
  11. {
  12. val = Serial.read();
  13. Serial.print(val);
  14. }
  15. if( val == 'H' ) // if 'H' was received
  16. {
  17. Serial.print(val);
  18. } else {
  19. Serial.print(val);
  20. }
  21. delay(100); // wait 100ms for next reading
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement