Wait... it actually kind of works. As in changing the number of bits and decoding in the middle of a bit period is consistent...
Added code to transmit a sequence of bits just as in the ipython notebook.