python接口到optotune焦距可调镜头
opto的Python项目详细描述
opto是一个python模块,允许您使用 这是Optotune Lens Driver 4。 用Optotune EL-10-30测试。
示例
打开串行端口,连接到光调谐,设置镜头电流 至50毫安,然后关闭串行端口,轻轻地将镜头恢复至0毫安 当前:
fromoptoimportOptoo=Opto(port='/dev/cu.usbmodem1411')o.connect()o.current(50.0)o.close(soft_close=True)
或者,这里我们使用with语句来创建正弦曲线 从最小电流到最大电流和反向的过渡:
fromoptoimportOptoimportnumpyasnpimporttimewithOpto(port='/dev/cu.usbmodem1411')aso:current_low=o.current_lower()current_high=o.current_upper()current_delta=current_high-current_lowforiinnp.linspace(0,2*np.pi,1000):o.current(np.sin(i)*current_delta+current_low)time.sleep(0.01)
安装
使用pip从github安装:
pip install git+https://github.com/OrganicIrradiation/opto.git
或者使用git克隆包:
git clone https://github.com/OrganicIrradiation/opto.git
要求
需要pySerial