Skip to content

3. Functions

Kravitz Lab edited this page Jan 3, 2021 · 21 revisions

These functions can be called in your sketch

Poke functions.

  • logLeftPoke(): Causes FED3 to increment LeftCount and log the left poke and duration to the SD card
  • logRightPoke(): Causes FED3 to increment RightCount and log the right poke and duration to the SD card

Feeding functions

  • Feed(): Causes FED3 to drop a pellet. FED3 will continue attempting to drop pellet until it is detected in the pellet well, and will initiate jam clearing operations automatically if it fails to dispense on the following schedule: Every 5th attempt (MinorJam); Every 10th attempt (VibrateJam); Every 10th attempt (ClearJam). Once it detects a pellet it increments PelletCount and waits for up to 60 seconds for the pellet to be removed so it can calculate retInterval. When pellet is removed it will send a 500ms pulse to the BNC port.
  • MinorJam(): Causes FED3 pellet disk to make a small backwards movement
  • VibrateJam(): Causes FED3 pellet disk to make a vibrating movement for ~10 seconds, stopping this movement if a pellet is detected
  • ClearJam(): Causes FED3 pellet disk to make a full rotation backwards and forwards, stopping this movement if a pellet is detected

Audio and Neopixel functions

  • pixelsOff(): Turn all Neopixels off
  • ConditionedStimulus(): Turn all pixels on a green/blue color and a 4000Hz tone for 200ms
  • leftStimulus(): Turn on left-most pixel. Note: you must have EnableSleep set to false to keep this pixel lit
  • rightStimulus(): Turn on right-most pixel. Note: you must have EnableSleep set to false to keep this pixel lit
  • Click(): Short "click" (800Hz tone for 8ms)
  • Noise(): ~500ms random noise stimulus
  • Tone(frequency, duration): Play a tone of set frequency and duration

FED3 output port

  • BNC(delay, number): Send number of pulses of length delay from the BNC output port.
Example: fed3.BNC(20, 5); //send five 20ms pulses from the BNC port

Display functions

  • UpdateDisplay(): Update all values on FED3 display

SDcard logging functions

  • logdata(): Log current data to the SD card. This will print one line to the data file containing the following fields:
MM:DD:YYYY hh:mm:ss, LibaryVersion_Sketch, Device_Number, Battery_Voltage, Motor_Turns, Trial_Info, FR, Event,
Active_Poke, Left_Poke_Count, Right_Poke_Count, Pellet_Count, Block_Pellet_Count, Retrieval_Time, Poke_Time
Clone this wiki locally