-
Hi, I wonder if it's possible to send particular events to the state machine during session. For example, I would like to be able to manually give a reward by clicking a button in the GUI. I can see that it is possible to send commands via com.pyboard.Pyboard.exec_raw_no_follow(). Could this be used in a straightforward way to send an event name or event ID that the board would put in the event queue? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi bdudok, Sending an event from the GUI is not officially supported as far as I can tell. Our lab had the same exact desire to be able to manually deliver reward from the GUI, so we hacked together a solution. In a nutshell, first we create a custom variable dialog with a button. The button communicates with Pycboard instance which then sends a serial message over USB to the pyboard microcontroller. The pyboard microcontroller is running a modified framework.py which recognizes the serial message, and then executes a function that is defined in the task file. It is an inelegant and not flexible/hard-coded solution, but it works. You can study the changes I made to give a basic example of this functionality. You can clone/download my call-tsk-fxn-from-gui branch and try it out by running the Hopefully it is enough to get you started. Let me know if you have further questions. @ThomasAkam let me know if this hack is a bad idea. I know there was also a callback API being developed by @neuromantic99 at some point. Perhaps we should create an issue/enhancement about adding this functionality. -Andy |
Beta Was this translation helpful? Give feedback.
Hi bdudok,
Sending an event from the GUI is not officially supported as far as I can tell. Our lab had the same exact desire to be able to manually deliver reward from the GUI, so we hacked together a solution.
In a nutshell, first we create a custom variable dialog with a button. The button communicates with Pycboard instance which then sends a serial message over USB to the pyboard microcontroller. The pyboard microcontroller is running a modified framework.py which recognizes the serial message, and then executes a function that is defined in the task file.
It is an inelegant and not flexible/hard-coded solution, but it works.
You can study the changes I made to give a basic example of…