Skip to content

Commit 0fba94e

Browse files
authored
Add files via upload
1 parent fe37cce commit 0fba94e

1 file changed

Lines changed: 52 additions & 50 deletions

File tree

examples/FORCE/FORCE.ino

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
1-
/*
2-
FORCE example code
3-
by Lex Kravitz and Bridget Matikainen-Ankney
4-
5-
alexxai@wustl.edu
6-
May, 2021
7-
8-
KravitzLabDevices/FORCE_library is licensed under the
9-
GNU General Public License v3.0
10-
11-
Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works
12-
and modifications, which include larger works using a licensed work, under the same license. Copyright and license
13-
notices must be preserved. Contributors provide an express grant of patent rights.
14-
15-
*/
16-
17-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
18-
// DON'T EDIT THESE LINES
19-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
20-
#include <Force.h> //Include FORCE library
21-
String ver = "v1.1.0"; //unique identifier text
22-
Force force(ver); //start FORCE object
23-
24-
void setup() {
25-
force.begin(); //setup FORCE
26-
}
27-
28-
void loop() {
29-
force.run(); //call force.run() at least once per loop
30-
31-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
32-
// WRITE CUSTOM BEHAVIORAL CODE BELOW HERE
33-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
34-
if (force.pressLength > force.hold_time) { //if the force lever is held down for longer than the hold_req
35-
force.presses++; //keep count of successful presses
36-
if (force.presses == force.ratio) { //if the ratio for number of presses is met
37-
if (force.PR == true) { //if it's a progressive ratio session
38-
if ((force.trial % force.trials_per_block) == 0) { //if the number of trials_per_block is reached
39-
force.req = force.req + 2; //inrease force requirement
40-
if (force.req > force.max_force) force.req = 2; // if force.req breaks max_force, reset to 2g
41-
}
42-
}
43-
force.Dispense(); //dispense reward
44-
force.presses = 0; //reset presses
45-
}
46-
else {
47-
force.Timeout(force.timeout_length); //timeout (length in seconds)
48-
}
49-
}
50-
}
1+
/*
2+
FORCE example code
3+
by Lex Kravitz and Bridget Matikainen-Ankney
4+
5+
alexxai@wustl.edu
6+
May, 2021
7+
8+
KravitzLabDevices/FORCE_library is licensed under the GNU General Public License v3.0
9+
10+
Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works
11+
and modifications, which include larger works using a licensed work, under the same license. Copyright and license
12+
notices must be preserved. Contributors provide an express grant of patent rights.
13+
14+
*/
15+
16+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17+
// DON'T EDIT THESE LINES
18+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
19+
#include <Force.h> //Include FORCE library
20+
String ver = "v1.1.1"; //unique identifier text
21+
Force force(ver); //start FORCE object
22+
23+
void setup() {
24+
force.begin(); //setup FORCE
25+
}
26+
27+
void loop() {
28+
force.run(); //call force.run() at least once per loop
29+
30+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
31+
// WRITE CUSTOM BEHAVIORAL CODE BELOW HERE
32+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
33+
if (force.pressLength > force.hold_time) { //if the force lever is held down for longer than the hold_req
34+
force.presses++; //keep count of successful presses
35+
if (force.presses == force.ratio) { //if the ratio for number of presses is met
36+
37+
//This code block runs only if it's a progressive ratio session
38+
if (force.PR == true) { //if it's a progressive ratio session
39+
if ((force.trial % force.trials_per_block) == 0) { //if the number of trials_per_block is reached
40+
force.req = force.req + 2; //increase force requirement
41+
if (force.req > force.max_force) force.req = 2; //if force.req breaks max_force, reset to 2g
42+
}
43+
}
44+
45+
force.Dispense(); //dispense reward
46+
force.presses = 0; //reset presses
47+
}
48+
else {
49+
force.Timeout(force.timeout_length); //timeout (length in seconds)
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)