Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

hidromotic May 19th, 2020 969 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Parpadeo de led
  2. //Mapear en una salida (11), el estado de una entrada en (7)
  3. #define PIN_LED 13
  4. #define CONFIGURAR_LED pinMode(PIN_LED,OUTPUT)
  5. #define ENCENDER_LED digitalWrite(PIN_LED,HIGH)
  6. #define APAGAR_LED digitalWrite(PIN_LED,LOW)
  7.  
  8. #define PIN_LED_BOT 11
  9. #define CONFIGURAR_LED_BOT pinMode(PIN_LED_BOT,OUTPUT)
  10. #define ENCENDER_LED_BOT   digitalWrite(PIN_LED_BOT,HIGH)
  11. #define APAGAR_LED_BOT     digitalWrite(PIN_LED_BOT,LOW)
  12.  
  13. #define PIN_BOT 7
  14. #define CONFIGURAR_BOT pinMode(PIN_BOT,INPUT)
  15. #define BOT_PRES       (digitalRead(PIN_BOT)==HIGH)
  16.  
  17. void setup() {
  18.   CONFIGURAR_LED;
  19.   CONFIGURAR_BOT;
  20.   CONFIGURAR_LED_BOT;
  21. }
  22.  
  23. void loop() {
  24.   if(BOT_PRES) ENCENDER_LED_BOT;
  25.   else        APAGAR_LED_BOT ;
  26.  
  27.   LedTest();
  28. }
  29.  
  30. void LedTest(void)
  31. {
  32.   static bool encender_led=0;
  33.   static unsigned long millis_ant=0;
  34.   if(millis()-millis_ant<1000)return;
  35.   millis_ant=millis();
  36.   // Invertir el estado del led
  37.   encender_led=!encender_led;
  38.  
  39.   if(encender_led) APAGAR_LED;
  40.   else             ENCENDER_LED;
  41.  
  42.  
  43.   //ENCENDER_LED;
  44.   //delay(1000);
  45.   //APAGAR_LED;
  46.   //delay(1000);
  47.  
  48.  
  49.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top