#include "Shifty.h"
const bool commonCathode = true; // I'm using common Cathode 7segment if you use common Anode then change the value into false.
// alpha-digit pattern for a 7-segment display
const byte digit_pattern[17] =
{
// 74HC595 Outpin Connection with 7segment display.
// Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
// a b c d e f g DP
0b11111100, // 0
0b01100000, // 1
0b11011010, // 2
0b11110010, // 3
0b01100110, // 4
0b10110110, // 5
0b10111110, // 6
0b11100000, // 7
0b11111110, // 8
0b11110110, // 9
0b11101110, // A
0b00111110, // b
0b00011010, // C
0b01111010, // d
0b10011110, // E
0b10001110, // F
0b00000001 // .
};
//Pin connected to ST_CP of 74HC595
int latchPin = 13;
//Pin connected to SH_CP of 74HC595
int clockPin = 14;
//Pin connected to DS of 74HC595
int dataPin = 12;
// Declare the shift register
Shifty shift;
byte count = 0;
void setup() {
Serial.begin(115200);
shift.setBitCount(16);
// Set the clock, data, and latch pins you are using
// This also sets the pinMode for these pins
// void Shifty::setPins(int dataPin, int clockPin, int latchPin, int readPin) {
shift.setPins(dataPin, clockPin, latchPin);
}
unsigned long interval_1 = 0;
bool blink_st = 0;
int pin_xx = 0;
void loop() {
for (int j = 0 ; j < 16; j++) {
shift.writeBit(j, HIGH);
delay(200);
}
delay(2000);
// shift.writeBit(2, LOW);
// shift.writeBit(4, LOW);
shift.writeBit(7, LOW);
shift.writeBit(15, LOW);
delay(2000);
for (int j = 0 ; j < 16; j++) {
shift.writeBit(j, LOW);
}
delay(2000);
}