SuperBrainAK

2 digit counting

Dec 23rd, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. char d1 '0';                   //the tens place.
  2. char d2 '0';                   //the ones place.
  3.  
  4. void loop (){
  5.   d2 ++;                       //increase the ones place by one.
  6.   if (d2 > '9'){               //if the ones place is greater than '9'...
  7.     d1 ++;                     //increase the tens place by one...
  8.     d2 = '0';                  //set the ones place to '0'.
  9.   }
  10.   if (d1 > '9'){               //if the tens place is greater than '9'...
  11.     d1 = '0';                  //set the tens place to '0'...
  12.     d2 = '0';                  //set the ones place to '0'.
  13.   }
  14.   disp (d1,false,d2,false);    //send the two digits to the display function.
  15.   delay(1000);                 //wait a second.
  16. }
Advertisement
Add Comment
Please, Sign In to add comment