Advertisement
rogerin

CodigoMiguel

Aug 13th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1.  
  2. const int buttonPin = 7;
  3. const int ledPin =  8;
  4. int buttonState = 0;
  5.  
  6. void setup() {
  7.   pinMode(ledPin, OUTPUT);      
  8.   pinMode(buttonPin, INPUT);    
  9. }
  10.  
  11. void loop(){
  12.   buttonState = digitalRead(buttonPin);
  13.  
  14.   if (buttonState == HIGH) {    
  15.     digitalWrite(ledPin, HIGH);  
  16.   }
  17.   else {
  18.     digitalWrite(ledPin, LOW);
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement