7 SEGMENT WITH COUNTER PROBLEM

Hey, guys I am currently building a multifunctional counter for the hydraulic crimper on my working company. I using 7 segment for prototype purpose and I using Hexadecimal for numbering (0-9)

So I wonder that it's possible to make the Count always equal the number. So that I didn't need to list out the number, it will tracing the count.

It's possible? please help me, I am new for arduino. My board is Arduino Uno R3. thanks a lot, guys

byte num0 = 0x3F;
byte num1 = 0x6;
byte num2 = 0x5B;
byte num3 = 0x4F;
byte num4 = 0x66;
byte num5 = 0x6D;
byte num6 = 0x7C;
byte num7 = 0x7;
byte num8 = 0x7F;
byte num9 = 0x6F;

//Currently is using some kind like this to turn on:

if (Cond ==1){
Count ++;
Cond =0;
}

if(Count == 0){
on(num0);
}
if(Count == 1){
on(num1);
}
if(Count == 2){
on(num2);
}
if(Count == 3){
on(num3);
}
//and so on.

Not entirely sure what you're asking, but I think what you're after is something like this:

byte display_counter[] = { 0x3F, 0x6, 0x5B, 0x4F, 0x66, 0x6D, 0x7C, 0x7, 0x7F, 0x6F };

if( Cond == 1 )
{
  Count ++;
  Cond = 0;
}

on( display_counter[Count] );

Yeah, that's what I'm looking. It's Array? :)

First of all, DON’T SHOUT! Please change the topic title. Second of all, place code within code tags. So first, go clean up your topic :wink:

But yes, you can. Use a array.

static const uint8_t Numbertable[] = {
 0x3F, /* 0 */
 0x06, /* 1 */
 0x5B, /* 2 */
 0x4F, /* 3 */
 0x66, /* 4 */
 0x6D, /* 5 */
 0x7D, /* 6 */
 0x07, /* 7 */
 0x7F, /* 8 */
 0x6F, /* 9 */
 0x77, /* a */
 0x7C, /* b */
 0x39, /* C */
 0x5E, /* d */
 0x79, /* E */
 0x71, /* F */
};

if(cond < 16){
  on(Numbertable[cond]);
}

See tip1
And if you ever need a big if statement like that, use a switch statement.