aboutsummaryrefslogtreecommitdiffhomepage
path: root/Stomps/read_stomp.py
blob: d1ff7f00155372e90b24ebc265b2e02d57266693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Quick and simple Python 2 script to read the raw bytes,
# from a stomp device on the Quad Cortex.

from stomp import StompEvent

with open('/dev/zencoder/knob_stomp2', 'rb') as file:
    byte_buffer = []
    while True:
        byte = file.read(1)
        if not byte:
            break

        byte_buffer.append(byte)
        if len(byte_buffer) is 32:
            event = StompEvent(byte_buffer)
            print event
            event.print_bytes()
            byte_buffer = []