Guillaume_D

compteur de secondes...

Feb 28th, 2022 (edited)
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. void setup()
  2. {
  3.   Serial.begin( 115200 );
  4. }
  5.  
  6. void loop()
  7. {
  8.   uint32_t t1 = millis();
  9.   static uint32_t t2 = t1;
  10.   static uint32_t secondes = 0;
  11.  
  12.   if ( t1 - t2 >= 1000 )
  13.   {
  14.     t2 = t1;
  15.     ++secondes;
  16.     Serial.println( secondes );
  17.   }
  18. }
Add Comment
Please, Sign In to add comment