JecarDatha Electronics ARDUINO MEGA 2560 | Page 12

MATERIALES

ARDUINO MEGA 2560

LED

DID SWITCH

JUMPERS

RESISTENCIA 220 OHMIO

int leds=2;

int pulsador=1;

void setup() {

pinMode(pulsador, INPUT);

pinMode(leds, OUTPUT);

}

void loop()

{

if(digitalRead(pulsador)==HIGH)

{

digitalWrite(leds, HIGH);

}

else

{

digitalWrite(leds, LOW);

}

}

9