Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BlinkSimétrico No bloqueante: Un led que destella,
- //donde el tiempo de encendido es el mismo que el de apagado.
- #define PIN_LED 13
- #define CONFIG_LED pinMode(PIN_LED, OUTPUT)
- #define AJUSTAR_LED(x) digitalWrite(PIN_LED, x)
- #define MS_ESPERA 50
- void setup() {
- // put your setup code here, to run once:
- CONFIG_LED;
- }
- void loop()
- {
- BlinkSimetrico();
- }
- void BlinkSimetrico(void)
- {
- static unsigned long millis_ant=0;
- static bool estado_led=0;
- if(millis() - millis_ant < MS_ESPERA) return;
- millis_ant=millis();
- estado_led= !estado_led;
- AJUSTAR_LED(estado_led);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement