Created
November 26, 2017 23:43
-
-
Save esmarr58/91240514b16f2efc4d039f50b5179e06 to your computer and use it in GitHub Desktop.
This file contains 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 tiempo1 = 0; | |
unsigned long tiempo2 = 0; | |
unsigned long tiempoSegundos = 0; | |
void setup() { | |
Serial.begin(9600); | |
tiempo1 = millis(); | |
} | |
void loop() { | |
tiempo2 = millis(); | |
if(tiempo2 > (tiempo1+1000)){ //Si ha pasado 1 segundo ejecuta el IF | |
tiempo1 = millis(); //Actualiza el tiempo actual | |
tiempoSegundos = tiempo1/1000; | |
Serial.print("Ha transcurrido: "); | |
Serial.print(tiempoSegundos); | |
Serial.println(" desde que se encendio el Arduino"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment