@@ -27,9 +27,6 @@ int trial_counter = 0; // Tracks how many pellet
2727int highp_counter = 0 ; // Tracks how many pokes in a row in high probability poke
2828int trialTimeout = 5 ; // timeout duration after each poke, set to 0 to remove the timeout
2929int probs[5 ] = {10 , 30 , 50 , 70 , 90 };
30- unsigned long trial_start = 0 ;
31- unsigned long trial_length = 5000 ;
32- bool trial_available = false ;
3330bool press = false ;
3431
3532void setup () {
@@ -65,19 +62,19 @@ void loop() {
6562 // //////////////////////////////////////////////////////////////
6663 force.readPoke ();
6764 if (force.poke ) {
68- force.run (true );
69- trial_start = millis ();
65+ force.run ();
66+ force. trial_start = millis ();
7067 force.Tone ();
71- trial_available = true ;
68+ force. trial_available = true ;
7269 }
7370
74- while (((millis ()-trial_start) < force.trial_window ) && trial_available == true ) {
71+ while (((millis ()-force. trial_start ) < force.trial_window ) && force. trial_available ) {
7572 force.ratioLeft = prob_left;
7673 force.ratioRight = prob_right;
7774 force.trials_per_block = trial_counter;
7875 force.FRC = highp_counter;
7976 force.library_version = trialsToSwitch;
80- force.run (true );
77+ force.run ();
8178
8279 // ///////////////////////////////////////////////////////////
8380 // // If mouse presses the left lever ///
@@ -90,15 +87,14 @@ void loop() {
9087 highp_counter = 0 ;
9188 }
9289 if (random (100 ) < prob_left) {
93- force.Tone ();
9490 force.DispenseLeft ();
9591 trial_counter ++;
9692 }
9793 else {
9894 force.Tone (300 ,600 );
9995 }
10096 press = true ;
101- trial_available = false ;
97+ force. trial_available = false ;
10298 }
10399
104100 // ////////////////////////////////////////////////////////////
@@ -112,31 +108,31 @@ void loop() {
112108 highp_counter = 0 ;
113109 }
114110 if (random (100 ) < prob_right) {
115- force.Tone ();
116111 force.DispenseRight ();
117112 trial_counter ++;
118113 }
119114 else {
120115 force.Tone (300 ,600 );
121116 }
122117 press = true ;
123- trial_available = false ;
118+ force. trial_available = false ;
124119 }
125120 }
126121
127122 // ////////////////////////////////////////////////////////////
128123 // // If there was no press during the time window ////
129124 // ///////////////////////////////////////////////////////////
130- if (trial_available && press == false ) {
125+ if (force. trial_available && press == false ) {
131126 force.Tone (300 ,600 );
127+ force.trial_available = false ;
132128 }
133129
134130 // ////////////////////////////////////////////////////////////
135131 // // Finish trial and start inter-trial timeout ////
136132 // ///////////////////////////////////////////////////////////
137133 if (press) {
138134 press = false ;
139- trial_available = false ;
135+ force. trial_available = false ;
140136 force.Timeout (trialTimeout);
141137 }
142138
0 commit comments