#include <LiquidCrystal_74HC595.h>
#define DS 11
#define SHCP 13
#define STCP 12
#define RS 1
#define E 2
#define D4 3
#define D5 4
#define D6 5
#define D7 6
LiquidCrystal_74HC595 lcd(DS, SHCP, STCP, RS, E, D4, D5, D6, D7);
byte heart[] = {
B00000,
B00000,
B11011,
B11111,
B11111,
B01110,
B00100,
B00000
};
char SHE1[4] = {0x09, 0x0A, 0x06, 0x05};
int timeSH[4] = {25, 25, 25, 25};
int i = 0;
unsigned long previousMicros = 0;
void setup() {
DDRD |= 0x0F; // Set PORTD (digital pins 3~0) to outputs
lcd.begin(16, 2);
lcd.setCursor(2, 0);
lcd.print("MASUD HASAN");
lcd.createChar(0, heart);
}
void loop() {
unsigned long currentMicros = micros();
// Check if the specified time has passed
if (currentMicros - previousMicros >= timeSH[i]) {
previousMicros = currentMicros; // Update the previous time
PORTD = (PORTD & 0xF0) | (SHE1[i] & 0x0F); // Set lower 4 bits of PORTD
i++; // Move to the next value
if (i >= 4) { // Reset the index if it exceeds the array size
i = 0;
}
}
lcd.setCursor(0, 1);
lcd.write(byte(0));
lcd.setCursor(15, 1);
lcd.write(byte(0));
lcd.setCursor(6, 1);
lcd.print(millis() / 250);
delay(1000);
}