JecarDatha Electronics ARDUINO MEGA 2560 | Page 10

MATERIALES

ARDUINO MEGA 2560

LED

DID SWITCH

JUMPERS

RESISTENCIA 220 OHMIO

programacion

int leds=2;

int p=1;

void setup() {

pinMode(1, INPUT);

pinMode(2, OUTPUT);

}

void loop() {

digitalWrite(leds, LOW);

leds=digitalRead(1);

if(leds==1)

{

digitalWrite(2, HIGH);

}

digitalWrite(2, LOW);

}

7