Skip to content

Python implementation of the comunication protocol used in Jaculus (https://jaculus.org)

Notifications You must be signed in to change notification settings

C2Coder/JacProtocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JacProtocol

Python implementation of the comunication protocol used in Jaculus (https://jaculus.org)

Installing

pip install https://github.com/c2coder/JacProtocol/archive/master.zip

Example encode code

from jacprotocol import jp

jp.put(97) # ascii code for "a"
# or jp.put(ord("a"))
channel = 16 # mux channel - 16 is monitor/terminal

for b in jp.serialize(channel):
    out += f"{hex(b)}  "
print(out)
from jacprotocol import jp
import serial # pip install pyserial

port = "/dev/ttyACM0"
baud = 921600

jp.put(97) # ascii code for "a"
# or jp.put(ord("a"))
channel = 16 # mux channel - 16 is monitor/terminal

# or if you want to send it over serial
with serial.Serial(port, baud, timeout=0) as ser:
    ser.write(jp.serialize(channel))

Example decode code

from jacprotocol import jp
import serial # pip install pyserial

port = "/dev/ttyACM0"
baud = 921600

# or if you want to send it over serial
with serial.Serial(port, baud, timeout=0) as ser:
    while True:
        l = list(ser.read_all()) # convert bytes to list of ints
        if len(l) == 0:
            continue
        print(jp.decode(l))

About

Python implementation of the comunication protocol used in Jaculus (https://jaculus.org)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages