Advertisement
Guest User

Untitled

a guest
Nov 8th, 2015
9,231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. char msg = ' '; //contains the message from arduino sender
  2. const int led = 13; //led at pin 13
  3. void setup() {
  4. Serial.begin(9600);//Remember that the baud must be the same on both arduinos
  5. pinMode(led,OUTPUT);
  6. }
  7. void loop() {
  8. while(Serial.available() > 0) {
  9.            msg=Serial.read();
  10.            if(msg=='H') {
  11.                digitalWrite(led,HIGH);
  12.            }
  13.            if(msg=='L') {
  14.                 digitalWrite(led,LOW);
  15.            }
  16. delay(1000);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement