Skip to content

Commit

Permalink
Merge pull request #2 from Leo246813/main
Browse files Browse the repository at this point in the history
The new optical lickometer
  • Loading branch information
AtMostafa committed Oct 21, 2024
1 parent 6b39749 commit 371cf60
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions devices/lickometer_2.py
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()

0 comments on commit 371cf60

Please sign in to comment.