Help with Arduino, 7-segment display, and code



so i'm trying semi unique , have limited knowledge of arduino coding (i've been able complete simple projects on own). i've built project box appropriate buttons , have purchased following 7-segment led display adafruit:
http://www.adafruit.com/products/1268

what trying create box when push "start" button, starts timer (of set time - 30 min, 45 min, etc) , timer shown on segment display. @ times, different pins written either high or low trigger wav trigger card. i've got "pause" button freeze time, , "go" button picks time left off when "pause" pushed. i've got 2 leds installed - 1 light when time in progress of running down, , other come on when timer paused.

i using arudino uno.


here's have far:
==================code starts here======================
#include <time.h>
#include <wire.h>
#include "adafruit_ledbackpack.h"
#include "adafruit_gfx.h"
adafruit_7segment matrix = adafruit_7segment();
time_t t;
tmelements_t tm;
int seconds, minutes;

int startbutton = 3;
int inprogled = 4;
int pausedled = 5;
int pausebutton = 6;

int timerrunning = 0;
int pausepushed = 0;

void setup(void)

  serial.begin(9600); //begin serial
  pinmode(startbutton, input);
  pinmode(pausebutton, input);
  pinmode(inprogled, output);
  pinmode(pausedled, output);
  digitalwrite(startbutton, high);
  digitalwrite(pausebutton, high);
 
    matrix.begin(0x70);
   
    tm.second = 0;
    tm.minute = 30;
    tm.day = 24;
    tm.month = 4;
    tm.year = calendaryrtotm(2015);
   
    t = maketime(tm);
   
     
}

void loop(void)
{
   matrix.print(10000, dec);
   matrix.writedisplay();
   if (digitalread(startbutton) == low) {
     timerrunning = 1;
   }
   if (digitalread(pausebutton) == low) {
     pausepushed= 1;
   }
  serial.println(pausebutton);
  serial.println(startbutton);
 
 
  if(timerrunning == 1){
    digitalwrite(inprogled, high);
    seconds = second(t);
    minutes = minute(t);
   
    matrix.writedigitnum(0, (minutes / 10) % 10, false);
    matrix.writedigitnum(1, (minutes % 10), false);
    matrix.drawcolon(true);
    matrix.writedigitnum(3, (seconds / 10) % 10, false);
    matrix.writedigitnum(4, seconds % 10, false);
    matrix.writedisplay();
    --t; //subtract second
    if (seconds + minutes == 0) {
        //digitalwrite(pin4, high);
    }
    if(pausepushed == 1){
      digitalwrite(pausedled, high);
      while(1);
    }
    delay(1000);
 }
}

can me? feel i'm guessing , making kindof work i'm not doing ther right way.

quote
can me?
with what? code improperly posted something. didn't does. didn't how differs want. weren't real clear on want, either.


Arduino Forum > Using Arduino > Programming Questions > Help with Arduino, 7-segment display, and code


arduino

Comments