ThePhilleBoy

7 seg 2 digit code help

Jan 24th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. /*
  2. 2 digit 7 seg count. But both digits show same number.
  3. 11,22,33,44... and so on.
  4. */
  5. const byte ledCharSet[10] = //which segments to light up, numbers: 0-9
  6. {
  7. B01110111, B00010100, B10110011, B10110110, B11010100,
  8. B11100110, B11100111, B00110100, B11110111, B11110110
  9. };
  10.  
  11. const int latchPin = 8;
  12. const int clockPin = 12;
  13. const int dataPin = 11;
  14.  
  15. void setup()
  16. {
  17. pinMode(latchPin, OUTPUT);
  18. pinMode(clockPin, OUTPUT);
  19. pinMode(dataPin, OUTPUT);
  20. }
  21.  
  22. void loop() {
  23. for (int i = 0; i < 10; i++) {
  24. shiftOut(dataPin, clockPin, MSBFIRST, ledCharSet[i]);
  25. shiftOut(dataPin, clockPin, MSBFIRST, ledCharSet[i]); //Here I need some help to make the number
  26. digitalWrite(latchPin, HIGH); //change everytime the last digit is 0
  27. delay(1000); //example: 29 to 30, when last digit turns to 0, first
  28. digitalWrite(latchPin, LOW); //digit + 1
  29. }}
Advertisement
Add Comment
Please, Sign In to add comment