/*
Demonstration of a T flip-flop designed using a gated D flip-flop
Check out Entry 24 at https://blog.jochumzen.com/p/entries.html
Click and hold T
Click CLK and Q = 1. Click CLK and Q = 0,...
If T = 0, nothing happens on CLK.
*/
//Library with basic gates
#include <ACELBG.h>
//Create an Arduino board
auto* ard = new ArduinoBoard();
//Define chips
auto* flipflop = new TFlipFlop();
//Add all chips to be emulated here
Chip* chips[] = {
flipflop
};
//Add all connections here
ConnectionBase* connections[] = {
new Connection(ard, 2, flipflop->T),
new Connection(ard, 3, flipflop->Clock),
new Connection(flipflop->Q, ard, 4),
};
//Section 6: Setting up the emulation. No need to change
Emulation emulation = Emulation(ard, chips, sizeof(chips)/2,
connections, sizeof(connections)/2);
void setup() {
Serial.begin(9600); Serial.println(); Serial.println("START");
Serial.println();
emulation.makePrintPin(13, 1);
}
void loop() {
emulation.emulate();
}
T
CLK
Q
Print