Go Down

Topic: I need help to make a counter with arduino 7 segments display and a pushbutton (Read 884 times) previous topic - next topic

victorfff

I'm new to Arduino and I'm trying to make a counter that by pressing the pushbutton mark on the display 00 , 01 , ...
each click will increase 1 , I came up here with a library named sevenseg ,
need help!!!

#include <SevenSeg.h>

SevenSeg disp (6,11,7,8,10,5,4);
int i=0,estado_botao=0;
const int numOfDigits=2;
int digitPins[numOfDigits]={9,2};
#define push 3
#define pressionado 1
#define n_pressionado 0
void setup() {
 pinMode(push,INPUT);
 disp.setDigitPins(numOfDigits,digitPins);

 disp.setTimer(2);
 disp.startTimer();

}

void loop() {
for(int i=1;i<=99;i++){
  disp.write(i);
  delay(1000);
}
  }
  ISR(TIMER2_COMPA_vect){
    disp.interruptAction();
  }
 

Go Up