Advertisement
tomateblue

luz.ino

Feb 2nd, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. char letra;
  2.  
  3. int luz=13;
  4.  
  5. void setup() {
  6.  Serial.begin(9600);
  7.  Serial.print("Iniciando comunicacao serial\n");
  8.  pinMode(luz,OUTPUT);
  9. }
  10.  
  11. void loop() {
  12.  
  13.  letra = Serial.read();
  14.  switch(letra)
  15.  {
  16.    case 'l':
  17.    Serial.print("ON\n");
  18.    digitalWrite(luz,HIGH);
  19.    break;
  20.    case 'd':
  21.    Serial.print("OFF\n");
  22.    digitalWrite(luz,LOW);
  23.    break;
  24.  }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement