コード例 #1
0
    def __init__(self):
        self.phase = PH_BREAK_OVER
        self.work_s = 0
        self.break_s = 0
        self.color = 0x000000
        self.colors = [0x000000 for _ in range(0, LIGHT_CNT)]

        self.client = gex.Client(gex.TrxRawUSB())
        self.btn = gex.DIn(self.client, 'btn')
        self.neo = gex.Neopixel(self.client, 'neo')
        self.btn.on_trigger([0], self.on_btn)

        self.switch(PH_BREAK_OVER)
        self.display()
コード例 #2
0
import time

import gex

# sipo example

with gex.Client(gex.TrxRawUSB()) as client:
    sipo = gex.SIPO(client, 'sipo')
    d4 = gex.DOut(client, 'd4')

    # Jort the lights
    sipo.load([
        [0x0a, 0x0f],
        [0xF8, 0xFC],
        [0x00, 0x00],
        [0x02, 0x00],
    ],
              end=0x04)

    d4.write(1)
    # sipo.set_data(0x04)
    # sipo.store()
コード例 #3
0
#!/bin/env python3
import time

import gex

# with gex.Client(gex.TrxRawUSB()) as client:
with gex.DongleAdapter(gex.TrxRawUSB(remote=True), 0x10) as transport:
    client = gex.Client(transport)
    print(client.ini_read(0))
コード例 #4
0
ファイル: gexync.py プロジェクト: gexpander/gexync
        client = gex.Client(self.xferLambda(), load_units=False)
        client.ini_write(new_txt)
        read_ini = client.ini_read(self.filenum)
        client.close()

        self.editor.setPlainText(read_ini)
        self.highlight.rehighlight()
        self.setWindowTitle('*GEX config file editor')

    def gexPersist(self):
        client = gex.Client(self.xferLambda(), load_units=False)
        client.ini_persist()
        client.close()
        self.setWindowTitle('GEX config file editor')


if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    editor = GexIniEditor(lambda: gex.TrxRawUSB())
    # editor = GexIniEditor(lambda: gex.TrxSerialThread(port='/dev/ttyUSB1',
    #                                                   baud=57600))

    # centered resize
    w = 800
    h = 900
    ss = app.desktop().availableGeometry().size()
    editor.setGeometry(int(ss.width() / 2 - w / 2),
                       int(ss.height() / 2 - h / 2), w, h)

    sys.exit(app.exec_())
コード例 #5
0
#!/bin/env python3
import time

import numpy as np
from matplotlib import pyplot as plt

import gex

transport = gex.TrxRawUSB(sn='0029002F-42365711-32353530')
#transport = gex.TrxSerialSync(port='/dev/ttyACM0')

with gex.Client(transport) as client:
    #
    # if True:
    #     s = client.ini_read()
    #     print(s)
    #     client.ini_write(s)

    if True:
        sipo = gex.SIPO(client, 'sipo')
        sipo.load([[0xA5], [0xFF]])

    if False:
        adc = gex.ADC(client, 'adc')
        print("Enabled channels:", adc.get_channels())

        adc.set_smoothing_factor(0.9)

        while True:
            raw = adc.read_raw()
            smooth = adc.read_smooth()