D-Flip-Flop

dev board Arduino UNO
chip SN74HC174
features D-Flip-Flop

Description

Test chip SN74HC174 Hex D-Type Flip-Flop with Arduino code.

Code

Download code
int clockPin = 8;
int dPin = 7;
int ledPin = 13;

void setup() {
  pinMode(clockPin, OUTPUT);
  pinMode(dPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(dPin, HIGH);
  delay(1000);

  digitalWrite(clockPin, LOW);
  delay(1000);
  digitalWrite(clockPin, HIGH);
  digitalWrite(ledPin, HIGH);
  delay(1000);

  digitalWrite(dPin, LOW);
  delay(1000);

  digitalWrite(clockPin, LOW);
  delay(1000);
  digitalWrite(clockPin, HIGH);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

Makefile

BOARD?=arduino:avr:uno
PORT?=/dev/cu.usbmodem14*
BUILD=build
# Arduino CLI version 0.14.0 is used.

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./

flash:
	arduino-cli upload --fqbn $(BOARD) --port $(PORT) --input-dir $(BUILD)

clean:
	rm -r build

Schematic

Wire up the hardware accordingly

D-Flip-Flop schematic