Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Blink
- //Led que se enciende, espera cierto tiempo, se apaga, espera otro tiempo y vuelve a repetir el ciclo
- #define PIN_LED 14
- #define CFG_LED pinMode(PIN_LED, OUTPUT)
- #define ENCENDER_LED digitalWrite(PIN_LED, HIGH)
- #define APAGAR_LED digitalWrite(PIN_LED, LOW)
- #define PIN_BOTON 9
- #define CFG_BOTON pinMode(PIN_BOTON, INPUT)
- #define BOTON_PRESIONADO digitalRead(PIN_BOTON)
- void setup()
- {
- // put your setup code here, to run once:
- CFG_LED;
- CFG_BOTON;
- APAGAR_LED;
- }
- void loop() {
- // put your main code here, to run repeatedly:
- if(BOTON_PRESIONADO) Blink();
- }
- void Blink(void)
- {
- ENCENDER_LED;
- //ESPERAR_TIEMPO_ENCENDIDO
- delay(100);
- APAGAR_LED;
- //ESPERAR_TIEMPO_APAGADO
- delay(900);
- }
Advertisement
Add Comment
Please, Sign In to add comment