Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <Arduino.h>
  2. byte x=0;
  3. char lupTable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
  4. char display[]={B111110,B111101,B111011,B110111};
  5. int x1,x2,z1,z2,z3,z4,y,y1,y2,y3,y4;
  6. int shift[]={12,8,4,0};
  7. int digit[4];
  8. int ccCode[4];
  9. void setup()
  10. {
  11. DDRB=B111111;
  12. DDRD=0xff;
  13. x1=0x24;
  14. x2=0x56;
  15. y=x1*x2;
  16. for (int i=0;i<=3;i++)
  17. {
  18. digit[i]=y>>shift[i];
  19. digit[i]=digit[i]&0x000f;
  20. ccCode[i]=lupTable[digit[i]];
  21. }
  22.  
  23. }
  24.  
  25. void loop()
  26. {
  27. PORTB= display[x];
  28. PORTD= ccCode[x];
  29. delay(2);
  30. x++;
  31. if (x>3) {x=0;}
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement