Go Down

Topic: 8x7seg (driver 595) trouble maintaining values on (Read 36 times) previous topic - next topic


New here, just got an arduino and I have been just playing around with a 8x 7segment display (595 driver).

I've figured out how to display Hello. Now, my objective is to count to 60 seconds, however, it never seems to work the way I want it to.

Code: [Select]

#include "Arduino.h"

int latchPin =  5; //RCK
int clockPin = 6; //SCK
int dataPin = 7; //DIO
byte num[10] = {B11000000, B11111001, B10100100, B10110000, B10011001, B10010010, B10000010, B11111000, B10000000, B10011000};

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);


void loop() {

for (int x2 =0 ; x2 < 7 ; x2 = x2 + 1)
        for (int x = 0 ; x < 10 ; x = x + 1)
          //SECONDS: ones column
          digitalWrite (latchPin,LOW);
          shiftOut(dataPin, clockPin, MSBFIRST, 2);
          shiftOut(dataPin, clockPin, MSBFIRST, num[x]);
          digitalWrite(latchPin, HIGH); 
          //SECONDS: 10's column
          digitalWrite (latchPin,LOW);
          digitalWrite(latchPin, HIGH); 

What happens is i will see the tens column perfectly, the number will glow. however, the ones column will flicker and I will see the number for a split second. It does count correctly, however the ones column never stays lit.

I can't figure out what is wrong.

Go Up