Skip to content

Writing A Behavioral Program

qmcgrath edited this page Feb 10, 2022 · 4 revisions

Anatomy of A Sipper Program

Example 1: Force Progressive Ratio

  1. Include library and name Force object
  1. Initialize force
  1. Call force.run() at least once per loop
  2. If the force lever is pressed hard enough for a sufficient length of time, the integer tracking the number of times the force was pressed is increased by one. If the ratio for number of presses it met, the code determines whether a progressive ratio session is active by checking the boolean PR variable. It then increases the force requirement by two grams each time the animal meets the hold time requirements and meets the force requirement. If the force requirement reaches a max value, it is reset to 2g. If the press number is not of the correct ratio, the device enters a timeout period. Users can feel free to modify this section to create their own custom progressive ratio task.
  1. Flash code and run!

Example 2: FORCE_randomout

  1. Include library and name Force object
  2. Initialize force
  3. Call force.run() at least once per loop.
  4. If the force lever is pressed hard enough for a sufficient length of time, the integer tracking the number of times the force was pressed is increased by one. Next, the code generates a random number between 1-3. If the number is 1 or 2, or about 66% of the time, a reward is dispensed and the force enters a timeout period. If the number is 3, or about 33% of the time, a tone is played. In addition, if the mouse licks the dispenser within 15 seconds a signal is played to pin 14 for 100 ms.
  1. Flash code and run!