D-Flip-Flop

Updated on 31 August 2021
dev board Arduino UNO
chip SN74HC174
features D-Flip-Flop
This tutorial is more than 1 year old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Code

Download code d-flipflop.ino
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

Description

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