• Great! Thanks for the update.

    To output the bit lengths, use:

    digitalPulse(myPin, 0, timeToLowerPulseFor);
    digitalPulse(myPin, 1, timeToRaisePulseFor);
    digitalPulse(myPin, 0, timeToLowerPulseFor);
    digitalPulse(myPin, 1, timeToRaisePulseFor);
    ...
    

    digitalPulse does some magic with interrupts that makes it much more accurate for a short series pulses than setTimeout would be.

About

Avatar for Gordon @Gordon started