Advertisement
Alexcnc

TM74HC595Display.h

Mar 14th, 2020
133
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <TM74HC595Display.h>
  2.  
  3. int SCLK = 7;
  4. int RCLK = 6;
  5. int DIO = 5;
  6.  
  7. TM74HC595Display disp(SCLK, RCLK, DIO);
  8. unsigned char LED_0F[29];
  9.  
  10. void setup() {
  11.   LED_0F[0] = 0xC0; //0
  12.   LED_0F[1] = 0xF9; //1
  13.   LED_0F[2] = 0xA4; //2
  14.   LED_0F[3] = 0xB0; //3
  15.   LED_0F[4] = 0x99; //4
  16.   LED_0F[5] = 0x92; //5
  17.   LED_0F[6] = 0x82; //6
  18.   LED_0F[7] = 0xF8; //7
  19.   LED_0F[8] = 0x80; //8
  20.   LED_0F[9] = 0x90; //9
  21.   LED_0F[10] = 0x88; //A
  22.   LED_0F[11] = 0x83; //b
  23.   LED_0F[12] = 0xC6; //C
  24.   LED_0F[13] = 0xA1; //d
  25.   LED_0F[14] = 0x86; //E
  26.   LED_0F[15] = 0x8E; //F
  27.   LED_0F[16] = 0xC2; //G
  28.   LED_0F[17] = 0x89; //H
  29.   LED_0F[18] = 0xF9; //I
  30.   LED_0F[19] = 0xF1; //J
  31.   LED_0F[20] = 0xC3; //L
  32.   LED_0F[21] = 0xA9; //n
  33.   LED_0F[22] = 0xC0; //O
  34.   LED_0F[23] = 0x8C; //P
  35.   LED_0F[24] = 0x98; //q
  36.   LED_0F[25] = 0x92; //S
  37.   LED_0F[26] = 0xC1; //U
  38.   LED_0F[27] = 0x91; //Y
  39.   LED_0F[28] = 0xFE; //hight -
  40.  
  41. }
  42.  
  43. void loop() {  
  44.  
  45.   disp.send(LED_0F[0], 0b0001);    //send digital "0" to 1st indicator
  46.   delay(2000);
  47.   disp.send(LED_0F[3], 0b0110);    //send digital "3" to 2nd and 3rd indicator
  48.   delay(2000);
  49.   disp.send(LED_0F[10], 0b1111);    //send simbol "A" to all indicators
  50.   delay(2000);
  51.  
  52.   for(int i = 0; i<=99; i++){
  53.   disp.digit2(i, 0b0001, 50);               //send counter 0-99 with delay 50 cicles int 1st and 2nd view ports
  54.   }
  55.  
  56.    for(int i = 0; i<=99; i++){
  57.   disp.digit2(i, 0b0100, 50);               //send counter 0-99 with delay 50 cicles int 3st and 4rd view ports
  58.   }
  59.  
  60.   for(int i = 0; i<=100; i++){
  61.   disp.digit4showZero(i, 50);               //send counter 0-100 with delay 50 cicles with zero
  62.   }
  63.  
  64.   for(int i = 0; i<=9999; i++){
  65.   disp.digit4(i, 50);               //send counter 0-9999 with delay 50 cicles and hide zero
  66.   }
  67.  
  68. }
Advertisement
RAW Paste Data Copied
Advertisement