forked from BeNeuroLab/PyTreadmillTask
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Leo246813/main
The new optical lickometer
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pyControl.hardware import Digital_input, Digital_output | ||
|
||
class Lickometer(): | ||
""" | ||
Optical lickometer to detect lick events | ||
Device documentation on: https://sanworks.io/shop/viewproduct?productID=1020 | ||
Configuration: | ||
Red wire: positive; Purple wire: negative | ||
Wires closer to the 4mm nut: emitter; wires further from: transistor | ||
# All purple wires --> GND | ||
# Transistor positive end --> Digital input port | ||
# Emitter positive end --> 500 ohm resistor --> Power source | ||
# Add a 40k pull-up resistor between power source and digital input | ||
""" | ||
|
||
def __init__(self, lick_port, sol_port, rising_event_A='lick_1', debounce=5, **kwargs): | ||
# Event triggered when pin is pulled down | ||
self.lick_1 = Digital_input(lick_port.DIO_A, rising_event_A, falling_event=None, debounce=debounce, pull=up) | ||
self.SOL_1 = Digital_output(sol_port.POW_A) | ||
self.SOL_1.off() |