Skip to content

Instantly share code, notes, and snippets.

@alexesDev
Last active December 27, 2020 09:03
Show Gist options
  • Save alexesDev/5abc62123f364a59320e8c2d86a504c2 to your computer and use it in GitHub Desktop.
Save alexesDev/5abc62123f364a59320e8c2d86a504c2 to your computer and use it in GitHub Desktop.
FF2232 in BitBang with python
from pylibftdi import BitBangDevice, Bus
import time
with BitBangDevice() as bb:
bb.baudrate = 60
bb.direction = 0xFF
bb.port = 0x00
i = 0
while True:
bb.port ^= (1 << i);
i = (i + 1) % 8
time.sleep(0.1)
from pylibftdi import BitBangDevice, Bus
import time
with BitBangDevice() as bb:
bb.baudrate = 60
bb.direction = 0xFF
bb.port = 0x00
i = 0
dir = 1
while True:
bb.port ^= (1 << i);
i += dir
if i == 8:
dir = -1
i -= 1
if i == -1:
dir = 1
i += 1
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment