Created
          July 17, 2019 21:22 
        
      - 
      
- 
        Save villares/afbe1904291996ee274b4e01ad2b18b9 to your computer and use it in GitHub Desktop. 
    A cada dois segundos, blink ou fade
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | unsigned long inicio; | |
| boolean modoBlink = true; | |
| void setup() { | |
| inicio = millis(); | |
| } | |
| void loop() { | |
| if (millis() - inicio > 2000) { // a cada 2 segundos (2000millisegundos) | |
| inicio = millis(); // reseta contador | |
| if (random(100) > 50) { // sorteia o modo que vai rolar | |
| modoBlink = true; | |
| } else { | |
| modoBlink = false; | |
| } | |
| } | |
| // faz o blink ou faz o fade | |
| if (modoBlink) { | |
| // códdigo para fazer o blink | |
| } else { | |
| // código para fazer o fade | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment