File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Software/Python/line_follower Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -134,15 +134,15 @@ def read_sensor():
134134
135135 for step in range (5 ):
136136 # calculate the 16-bit number we got
137- sensor_buffer [i ].append (bytes_list [2 * step ] * 256 + bytes_list [2 * step + 1 ])
137+ sensor_buffer [step ].append (bytes_list [2 * step ] * 256 + bytes_list [2 * step + 1 ])
138138
139139 # if there're too many elements in the list
140140 # then remove one
141- if len (sensor_buffer [i ]) > max_buffer_length :
142- sensor_buffer [i ].pop (0 )
141+ if len (sensor_buffer [step ]) > max_buffer_length :
142+ sensor_buffer [step ].pop (0 )
143143
144144 # eliminate outlier values and select the most recent one
145- filtered_value = statisticalNoiseReduction (sensor_buffer [i ], 2 )[- 1 ]
145+ filtered_value = statisticalNoiseReduction (sensor_buffer [step ], 2 )[- 1 ]
146146
147147 # append the value to the corresponding IR sensor
148148 output_values .append (filtered_value )
You can’t perform that action at this time.
0 commit comments