public void doStep() {
        boolean v1 = volts[0] > 2.5;
        boolean v2 = volts[1] > 2.5;
        if (v1 && !pins[0].value) {
            ff1 = true;
        }
        if (v2 && !pins[1].value) {
            ff2 = true;
        }
        if (ff1 && ff2) {
            ff1 = ff2 = false;
        }
        double out = (ff1) ? 5 : (ff2) ? 0 : -1;
        //System.out.println(out + " " + v1 + " " + v2);
        if (out != -1) {
            sim.stampVoltageSource(0, nodes[2], pins[2].voltSource, out);
        } else {
            // tie current through output pin to 0
            int vn = sim.nodeListSize() + pins[2].voltSource;
            sim.stampMatrix(vn, vn, 1);
        }
        pins[0].value = v1;
        pins[1].value = v2;
    }