document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. const int ledPin = 13; // the pin that the LED is attached to - change this if you have a separate LED connected to another pin
  2. int incomingByte; // a variable to read incoming serial data into
  3.  
  4. void setup() {
  5. // initialize serial communication:
  6. Serial.begin(9600);
  7. // initialize the LED pin as an output:
  8. pinMode(ledPin, OUTPUT);
  9. }
  10.  
  11. void loop() {
  12. // see if there's incoming serial data:
  13. if (Serial.available() > 0) {
  14. // read the oldest byte in the serial buffer:
  15. incomingByte = Serial.read();
  16. // if it's a capital H (ASCII 72), turn on the LED:
  17. if (incomingByte == 'H') {
  18. digitalWrite(ledPin, HIGH);
  19. }
  20. // if it's an L (ASCII 76) turn off the LED:
  21. if (incomingByte == 'L') {
  22. digitalWrite(ledPin, LOW);
  23. }
  24. }
  25. }
');