PinIO.output(pin, False) # Next step step_counter += 1 # If we reach the end of the sequence, start again if (step_counter == 8): step_counter = 0 # Wait before moving on Time.sleep(stepper_wait) # Advance cycle counter when step counter resets if (step_counter == 0): cycle_counter += 1 # Take photo based on cycle counter if (cycle_counter == cycles_per_photo): # Make sure saving folder exists sub_folder = frames_dir + '/' + str(int(ceil(photo_counter / 1000))) if (not path_exists(sub_folder)): make_dir(sub_folder, 0777) # Wait and snap Time.sleep(photo_wait) camera.snap(sub_folder + '/' + str(photo_counter) + '.jpg') # Next cycle_counter = 0 photo_counter += 1