int pinBoton = 2;
int pinLed = 10;
void setup() {
pinMode(pinLed, OUTPUT);
// INPUT_PULLUP: Hay que mantener apretado
// para que mantenga el estado
pinMode(pinBoton, INPUT_PULLUP);
}
void loop() {
int estadoBoton = digitalRead(pinBoton);
while(estadoBoton == LOW){
digitalWrite(pinLed, HIGH);
estadoBoton = digitalRead(pinBoton);
}
digitalWrite(pinLed, LOW);
}