Rsync correct code #115
-
Hi, I am trying to sync my pyControl breakout board whit a camera using the Rsync class, but I have trouble writing the correct syntax. That is what I write: class Rsync(pin, event = 'rsync', mean_IPI=5000, pulse_dur=50) sync_output = Rsync(pin = board.BNC_1, mean_IPI=5000) rsync is defined in the events and board is defined as the breakout board (after importing from devices). |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @LiliVig You just need to put the second code line in either your task file or hardware definition: board = Breakout_1_2() # Instantiate the breakout board object
sync_output = Rsync(pin = board.BNC_1, mean_IPI=5000) # Instantiate the Rsync output on breakout board BNC 1. Then make sure the |
Beta Was this translation helpful? Give feedback.
-
Hmm, I have already imported that. I was also wondering if that could be
the issue, I also didn’t find any definition of Rsync in devices or
utilities. How do I fix this?
…On Thu 11. Jan 2024 at 13:31, Thomas Akam ***@***.***> wrote:
You don't need to define the Rsync class but you do need to import it,
which is usually done with from devices import *.
This is code for a minimal example task that generates rsync pulses:
from pyControl.utility import *from devices import *
# Define hardware (normally done in seperate hardware definition file).
board = Breakout_1_2() # Instantiate the breakout board objectsync_output = Rsync(pin=board.BNC_1, mean_IPI=5000) # Instantiate Rsync output
# States and events.
states = ["state_1"]
events = ["rsync"]
initial_state = "state_1"
# State behaviour functions
def state_1(event):
pass
—
Reply to this email directly, view it on GitHub
<#115 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFHQLXE4C3U5ALLFYMSERYDYN7LSRAVCNFSM6AAAAABBWFZXP2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DAOJUGM3TA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
The Rsync aligner class is defined in pyControl.hardware but imported into devices in the devices init file, so as long as you have Can you please upload your full task code that is not working and a screenshot of the pycontrol gui window with the error when you upload the task. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Just before sending you the screenshots, I found the mistake, I was
overwriting on some other code that imported only the board and the LED
driver, not all devices, now the problem is fixed😅
Sorry to bother you and thank you for your help, at least now I understand
better how the Rsync works!
Best wishes!
…On Thu 11. Jan 2024 at 18:35, Thomas Akam ***@***.***> wrote:
The Rsync aligner class is defined in pyControl.hardware
<https://github.com/pyControl/code/blob/master/source/pyControl/hardware.py>
but imported into devices in the devices *init*
<https://github.com/pyControl/code/blob/master/devices/__init__.py> file,
so as long as you have from devices import * at the top of your task file
you should be able to use it.
Can you please upload your full task code that is not working and a
screenshot of the pycontrol gui window with the error when you upload the
task.
—
Reply to this email directly, view it on GitHub
<#115 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFHQLXH6EEI42ICQLAJNTPDYOAPHLAVCNFSM6AAAAABBWFZXP2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DAOJYHE2DE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
You don't need to define the Rsync class but you do need to import it, which is usually done with
from devices import *
.This is code for a minimal example task that generates rsync pulses: