#include <SPI.h> // Include the SPI library
#include <Wire.h> // Include the Wire library for Serial communication
#define DATA_PIN D11 // Data pin DS
#define CLOCK_PIN D13 // Clock pin SHCP
#define LATCH_PIN D10 // Latch pin STCP
void shiftOutCustom(byte dataPin, byte clockPin, byte latchPin, byte val) {
digitalWrite(latchPin, LOW); // Pull latch low to start sending data
shiftOut(dataPin, clockPin, LSBFIRST, val);
digitalWrite(latchPin, HIGH); // Pull latch high to update the outputs
}
const byte segments[] = {
B11111100, // 0
B01100000, // 1
B11011010, // 2
B11110010, // 3
B01100110, // 4
B10110110, // 5
B10111110, // 6
B11100000, // 7
B11111110, // 8
B11110110 // 9
};
void setup() {
Serial.begin(9600);
pinMode(DATA_PIN, OUTPUT);
pinMode(CLOCK_PIN, OUTPUT);
pinMode(LATCH_PIN, OUTPUT); // Set latch pin as output
// Initialize other pins as needed
}
void loop() {
// Display the digit 5 on the 7-segment display
shiftOutCustom(DATA_PIN, CLOCK_PIN, LATCH_PIN, segments[5]); // Display the digit 5
// Check if the 7-segment display is showing the digit 5
if (segments[5] == B10110110) {
Serial.println("The program is correct and is displaying the digit 5 on the 7-segment display.");
}
delay(1000);
}