Skip to content

Instantly share code, notes, and snippets.

@jaredwolff
Created November 2, 2018 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredwolff/f828224c762eb9873f5ca41866cf2670 to your computer and use it in GitHub Desktop.
Save jaredwolff/f828224c762eb9873f5ca41866cf2670 to your computer and use it in GitHub Desktop.
Saleae Logic 8 - Long Term Capture for Current and Voltage Logging (Python Script)
#!/usr/bin/env python3
# One common issue is that Saleae records traces into memory, which means that
# it can't handle very long captures. This example shows how to use scripting to
# do long recordings over time. There will be brief gaps every time Saleae saves
# the old recording and starts a new one.
import os
import time
import saleae
folder = time.strftime('%Y-%m-%d--%H-%M-%S')
os.mkdir(folder)
s = saleae.Saleae()
# print s.get_all_sample_rates()[6]
s.set_active_channels([],[0,1,2,3,4])
s.set_num_samples(1000 * 60 * 60)
s.set_sample_rate(s.get_all_sample_rates()[6])
for i in range(1,15):
path = os.path.abspath(os.path.join(folder, str(i)))
s.capture_to_file(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment