Skip to content

Instantly share code, notes, and snippets.

@MightyPork
Created April 23, 2018 20:20
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 MightyPork/6ff9138aa42e8dd1318045f147148d52 to your computer and use it in GitHub Desktop.
Save MightyPork/6ff9138aa42e8dd1318045f147148d52 to your computer and use it in GitHub Desktop.
#!/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