Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save urmil0071/d67d22a5348938a84d816042f6f2957c to your computer and use it in GitHub Desktop.
Save urmil0071/d67d22a5348938a84d816042f6f2957c to your computer and use it in GitHub Desktop.
Create an array for the temperature 25.74degreeC and transfer value into 4 CC7SD Display Unit
##include <Arduino.h>
byte x=0;
char lupTable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5E,0x79,0x71};
char display[]={B111110,B111101,B111011,B110111};
int x1,x2,z1,z2,z3,z4,y1,y2,y3,y4;
int shift[]={12,8,4,0};
int digit[4];
int ccCode[4];
void setup()
{
DDRB=B111111;
DDRD=0xff;
byte y[]={0x2,0x5,0x7,0x4};
for (int i=0;i<=3;i++)
{
digit[i]=y[i]>>shift[i];
digit[i]=digit[i]&0x000f;
ccCode[i]=lupTable[digit[i]];
}
}
void loop()
{
PORTB= display[x];
PORTD= ccCode[x];
delay(2);
x++;
if (x>3) {x=0;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment