Constant Pressing for Pellet Drop

MEDState Notation Repository Forums Coding Help Archive Constant Pressing for Pellet Drop

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16775
    Jacob Jackson
    Participant

    Hello,

    I’ve been learning TRANS V for about a month now and I’ve figured out most of what I need the program to run but I’ve been stuck on trying to make it so that the animal needs to hold the lever down to receive food. What I’m trying to do is have the animal hold down the lever for a certain number of seconds and then receive food. If the animal doesn’t hold this long, it won’t receive food. I noticed on the SmartCTL DIG-716 card that the input light stays lit when I hold down the lever but in the MED-PC program, the number for the input only flashes. I’ve added my code at the bottom so far. Right now, it just waits 0.4 seconds after a press to deliver food instead of being pressed for 0.4 seconds. Is there a way to combine a time and response input?

    Thank you,
    Jacob

    \Jacob Jackson
    \Animal must hold the lever down for X” seconds to receive pellet
    \ 10-12-21

    \Constants:
    ^LeftLvr=1\the lever lever is input 1
    ^HouseLight=7\Houselight
    ^Pellet=3\the pellet dispenser is output 4
    ^LeftLight=4 \left light above lever

    S.S.1,
    S3,\Turn on houselight as soon as box is loaded
    .01″:On ^Houselight—>S4
    S4,
    .01″:On ^LeftLight —> S1 \turn on left light as soon as box is loaded

    S.S.2
    S1,
    #R^LeftLvr:—>S2 \Wait for resposne

    S2,
    0.4″:—>S3 \Wait 0.4 seconds

    S3,
    0.01″:On ^Pellet;Add A;Show 1,Pellets,A—>S4 \dispense pellet, add 1 to pellet counter
    S4,
    .1″: Off ^Pellet—>S1 \Turn off dispenser

    S.S.3,
    S1,
    .01″:On ^LeftLvr—>S2 \Turn on lever at start
    S2,
    30″:Off ^LeftLvr—>SX \Turn off lever after X” seconds

    S.S.4
    S1,
    30″: Off ^Houselight—>S1 \Turn off houselight after X” seconds

    #16776
    Med_Support
    Moderator

    The SmartCtrl inputs have 2 settings Toggle vs. Level.
    to time the lever press you would need to set the input to level mode. This is a hardware setting that will require you to take the card out and physically switch the input to level mode.

    Pseudo code: *update Y to 40 for .4 second hold.
    \***************************************************
    \ RESPONSE DEFINED – 20ms BREAK, 20ms RELEASE
    \***************************************************
    S.S.2,
    S1, \ Inputs in Level Mode generate an input “count” on each
    \ interrupt. With a 10 ms system resolution 2 counts will
    \ be reached in 20 ms. The Z^LeftBreak pulse is used to
    \ signal a completed Response. The second statement resets
    \ the counter every 20 ms so that a partial Response of
    \ less than 20 ms will not be counted.
    #R^LeftLever: ADD Y; IF Y >= 2 [@Response, @NoResponse]
    @Response: SET Y = 0; Z^LeftBreak —> S2
    @NoResponse: —> SX
    0.02″: SET Y = 0 —> S1

    #16795
    Jacob Jackson
    Participant

    Thank you for the quick response. One quick question, what is the best way to remove the card from the interface? I looked in the manual but couldn’t find any information.

    Thank you for your help.

    #16796
    Med_Support
    Moderator

    Remove only the bottom screw on the card (under part number DIG-716).
    Screw cable into card and pull from the cable firmly but gently.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.