SHARE
TWEET

gui.ino

richigarza Nov 10th, 2012 1,823 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int i = 0;
  2. #define leduno 4
  3. #define leddos 5
  4. #define ledtres 6
  5. #define ledcuatro 7
  6. #define motor 13
  7.  
  8. // the setup routine runs once when you press reset:
  9. void setup() {    
  10.   Serial.begin(9600);
  11.   for (i=4; i<=7; i++){
  12.        pinMode(i, OUTPUT);        
  13.   }
  14.  
  15. }
  16.  
  17. // the loop routine runs over and over again forever:
  18. void loop() {
  19.   if(Serial.available()) {
  20.     char in = Serial.read();
  21.  
  22.     if(in == 'U'){
  23.         digitalWrite(leduno, HIGH);
  24.         digitalWrite(leddos, LOW);
  25.         digitalWrite(ledtres, LOW);
  26.         digitalWrite(ledcuatro, LOW);
  27.         digitalWrite(motor, LOW);
  28.        
  29.     }
  30.      
  31.     if(in == 'D'){
  32.         digitalWrite(leduno, LOW);
  33.         digitalWrite(leddos, HIGH);
  34.         digitalWrite(ledtres, LOW);
  35.         digitalWrite(ledcuatro, LOW);
  36.         digitalWrite(motor, LOW);
  37.     }
  38.        
  39.     if(in == 'T'){
  40.         digitalWrite(leduno, LOW);
  41.         digitalWrite(leddos, LOW);
  42.         digitalWrite(ledtres, HIGH);
  43.         digitalWrite(ledcuatro, LOW);
  44.         digitalWrite(motor, LOW);
  45.     }
  46.      
  47.     if(in == 'C'){
  48.         digitalWrite(leduno, LOW);
  49.         digitalWrite(leddos, LOW);
  50.         digitalWrite(ledtres, LOW);
  51.         digitalWrite(ledcuatro, HIGH);
  52.         digitalWrite(motor, LOW);
  53.     }
  54.    
  55.     if(in == 'M'){
  56.         digitalWrite(leduno, LOW);
  57.         digitalWrite(leddos, LOW);
  58.         digitalWrite(ledtres, LOW);
  59.         digitalWrite(ledcuatro, LOW);
  60.         digitalWrite(motor, HIGH);
  61.     }
  62.   }
  63. }
RAW Paste Data
Top