Created
April 23, 2018 20:20
-
-
Save MightyPork/6ff9138aa42e8dd1318045f147148d52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
import time | |
import gex | |
import numpy as np | |
from matplotlib import pyplot as plt | |
import datetime | |
from scipy.io import wavfile | |
# ADC channel 1 -> 100n -> o -> long wire (antenna) | |
# | | |
# '-> 10k -> GND | |
def capture(tr): | |
now=datetime.datetime.now() | |
now.isoformat() | |
data = tr.data | |
print("Capture! ") | |
print(data) | |
np.save("lightning-%s"%now.isoformat(), data) | |
with gex.Client(gex.TrxRawUSB()) as client: | |
adc = gex.ADC(client, 'adc') | |
adc.set_sample_rate(20000) | |
adc.on_trigger(capture) | |
adc.setup_trigger(1, | |
level=2600, | |
count=5000, | |
edge='rising', | |
pretrigger=500, | |
holdoff=500, | |
auto=True) | |
adc.arm() | |
sec = 0 | |
while True: | |
print('%d s' % sec) | |
sec += 1 | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment