Beispiel #1
0
from pybpodapi.com.arcom import ArCOM, ArduinoTypes
import time
import threading

bpod = Bpod()

trials = 10

#==============================================================================
# rotary encoder config
#==============================================================================
rotary_encoder = [x for x in bpod.modules if x.name == "RotaryEncoder1"][0]

reset_re = 1

bpod.load_serial_message(rotary_encoder, 1, [ord('Z'), ord('E')])
bpod.load_serial_message(rotary_encoder, 2, [ord("#"), 2])

#====================================
# onfigure encoder
#====================================
rotary_encoder = RotaryEncoderModule('COM6')

ALL_THRESHOLDS = [-10, 10]
ENABLE_THRESHOLDS = [True, True, False, False, False, False, False, False]

rotary_encoder.set_zero_position()  # Not necessarily needed
rotary_encoder.set_thresholds(ALL_THRESHOLDS)
rotary_encoder.enable_thresholds(ENABLE_THRESHOLDS)
rotary_encoder.enable_evt_transmission()
rotary_encoder.close()
waveplayer.set_loop_mode(
    [False, False, False, False, False, False, False, False])
#waveplayer.set_loop_mode([False, False, False, False])
waveplayer.debug()

print(waveplayer.load_waveform(1, wave))

waveplayer.disconnect()

# create bpod object all necessary settings are imported from GUI
bpod = Bpod('COM5')
bpod.modules[0].name
bpod.modules[1].name

wave_player = [x for x in bpod.modules if x.name == "WavePlayer1"][0]
bpod.load_serial_message(wave_player, 1, [ord('P'), 3, 0])  #15=1111
#wave_player.load_message([ord('P'), 15, 1],1)
"""
for _ in range(10):
    print(f"loop:{_}")
    waveplayer.play(1,1)
    waveplayer.play(2,1)
    waveplayer.play(3,1)
    waveplayer.play(4,1)

    time.sleep(5)
    waveplayer.stop()

waveplayer.disconnect()"""

#from pybpodapi.com.arcom import ArCOM, ArduinoTypes