kalibre

scretch_jfx_KNB

Sep 10th, 2015
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 1.23 KB | None | 0 0
  1. bem10jfx.blogspot.com.br
  2. knbjfx.blogspot.com.br
  3.  
  4.  
  5. int pin_12=12;
  6. int pin_11=11;
  7. int pin_10=10;
  8. int vlx=0;
  9.  
  10. void setup(){
  11. Serial.begin(9600);
  12. pinMode(pin_10,OUTPUT);
  13. pinMode(pin_11,OUTPUT);
  14. pinMode(pin_12,OUTPUT);
  15.  
  16. }
  17.  
  18. void loop(){
  19. Serial.println("esperando");
  20.  
  21.   if(Serial.available()>0){
  22.   int in=Serial.read();
  23.  
  24.   if(in=='q'){
  25.    
  26.     Serial.println("ligando led verde");
  27.     digitalWrite(pin_12,HIGH);
  28.     delay(1000);
  29.     digitalWrite(pin_12,LOW);
  30.   }else if(in=='w'){
  31.     Serial.println("ligando led amarelo");
  32.     digitalWrite(pin_11,HIGH);
  33.     delay(1000);
  34.     digitalWrite(pin_11,LOW);
  35.    
  36.   }else if(in=='e'){
  37.     Serial.println("ligando led vermelho");
  38.     digitalWrite(pin_10,HIGH);
  39.     delay(1000);
  40.     digitalWrite(pin_10,LOW);
  41.    
  42.     }else if(in=='a'){
  43.     Serial.println("Verde");
  44.     digitalWrite(pin_10,HIGH);
  45.     delay(1000);
  46.     digitalWrite(pin_10,LOW);
  47.     Serial.println("Amarelo");
  48.     digitalWrite(pin_11,HIGH);
  49.     delay(1000);
  50.     digitalWrite(pin_11,LOW);
  51.     Serial.println("Vermelho");
  52.     digitalWrite(pin_12,HIGH);
  53.     delay(1000);
  54.     digitalWrite(pin_12,LOW);
  55.    
  56.     }
  57.    
  58.     Serial.print("coamndo enviado ");
  59.     Serial.println(in);
  60.  
  61. }    
  62.   delay(3000);
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment