Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Problem sending SerialPort Triggers

Hi everyone,

I'm trying to build an ERP oddball experiment but I'm having trouble sending the triggers. Since I'm new to code, I've managed to collect information from the forum discussions and have used the following inline scripts:

#SerialPort_Open
import serial
exp.serial_port = serial.Serial('COM3')

#SerialPort_Send
exp.serial_port.write(chr(1))

#SerialPort_Close
exp.serial_port.close()

The EEG is being recorded with Biosemi ActiveTwo system and the ActiView software. Although the experiment run as expected, no trigger is sent. I've tried to move the SerialPort_Open inline script before the loop but the experiment crashes with the following error:

 File "C:\Program Files (x86)\OpenSesame\lib\site-packages\serial\serialwin32.py", line 62, in open
  raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
SerialException: could not open port 'COM3': WindowsError(2, 'El sistema no puede encontrar el archivo especificado.')

I wonder if there may be some error in the python code or if I didn't insert the Inline scripts in the correct place. I've attached an image of a simplified version of the experiment so you can have a look at the structure.

Does anyone have any suggestions?

Thanks in advanced,

Jose

Comments

  • Hi,

    I am running the same kind of experiment. I managed to see the triggers on the recording software with this method (the port is a serial port and I've found the address of the port in the Windows Device Manager).

    First, I put this inline script at the very beginning of my experiment.

    Then I put this inline script after each stimulus

    After that, I put an inline script to reset the port to zero (for example at the end of the trial sequence).

    Always write the code in the "Run" tab and not the Prepare tab. And that's it. It works for me, but I am very new to OpenSesame so I am not sure that this is the best solution to your problem !

    Eva

  • Hi Eva,

    Thanks for your answer. I have made some changes following your comments, however, triggers are still not sending. Attached a simplified version of the experiment just to try to solve this problem.

    The inline scripts are as follows:

    For SerialPort_Open

    import serial
    exp.serial_port = serial.Serial('COM3')
    exp.cleanup_functions.append(exp.serial_port.close)
    

    For SerialPort_Send

    exp.serial_port.write(chr(1))
    

    For resetPort_to_0

    exp.serial_port.write(chr(0)) 
    

    For SerialPort_Close

    exp.serial_port.close()
    

    The experiment doesn't crash, but it doesn't send triggers either. Does anyone has any clue how to get through this issue?

  • edited February 20

    Could be an issue on the receiving end. I am not too familiar with BioSemi, but:

    • Some systems are really finicky about specifying the baud rate.
    • What does Biosemi "expect" to see? Perhaps you should do a byte conversion on your end, so something along the lines of (for Python3):
    serial_port.write(bytes([1]))
    

    Like I said, total guesswork though. Maybe BioSemi support will be able to better assist you.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games