Skip to content

Arduino Codes

HugoGreenhill edited this page Jan 27, 2025 · 3 revisions

Arduino Codes and Implementations

Arduino Functions

Load the functions from Arduino Code into your Arduino IDE.

Descriptions of functions:

  1. Button.ino >> checkbuttons() | Allows adjustment of spout in boot-up while checking buttons B & C, runtime updated on OLED screen.
  2. Dispense.ino >> dispense(int selection) | Dispenses appropriate amount of solution through the spout selection. Volume is pre-set requires editing: switch statement and global variable volume should be implemented
  3. Display.ino >> UpdateDisplay() | Updates OLED display
  4. Retract_Extend.ino >> retract() - allows retraction of the spout via servo || extend() - allows extension of the spout via servo -- implemented to go to position pos (defined at Arduino boot) requires editing: closed-loop with lickometer to adjust if over-extended/not far enough
  5. Rotate.ino >> spoutPosition(int num) | Uses _num _to define which spout is being used, and rotates the spouts such that appropriate spout is in front of mouse.
  6. Timeout.ino >> timeout(int low, int high) | Uses a a timeout of random duration between low and high seconds to prevent continuous trials
  7. Tone.ino >> playtone(int frequency, int duration) | Plays a tone of frequency pitch for duration time || noise() | Plays a random set of tones (20ms each) for 1 second (50 random tones)
  8. Wash.ino >> dispenses through all 5 ports, to be implemented with EtOH and H2O
  9. customDelay.ino >> customDelay(int milliseconds) | does nothing over _milliseconds _of time and updates display after delay. This allows gravity-fed alteration of dispensed volume

lick_timer.h Implements millis() and some kind of low/high touch sensor to time licks. After instatiating with lick_timer.boot(), the lick_timer can be started (.start()), stopped (.stop()), and probed for current information (.get_licks()). The timer will only 'forget' its stored information when restarted.

Clone this wiki locally