Created
January 18, 2020 00:16
-
-
Save dwblair/2c9d50ef4672c3e98473186d9b54e563 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import serial | |
PORT='/dev/ttyACM0' | |
s=serial.Serial(PORT,115200,timeout=1) | |
SIZE = 1 | |
NUM = 1000 | |
RES = 12 | |
RATE = 10 | |
SAMP_SPEED = 4 | |
CONV_SPEED = 4 | |
# SET UP THE SAMPLING | |
s.write('ADC.SET_SIZE '+str(SIZE)+'\n\r') # number of samples to grab in one go | |
s.write('ADC.SET_NUM '+str(NUM)+'\n\r') # number of times to repeat the sample grab | |
s.write('ADC.SET_RES '+str(RES)+'\n\r') # resolution | |
s.write('ADC.SET_CONV_SPEED '+str(CONV_SPEED)+'\n\r') | |
s.write('ADC.SET_SAMP_SPEED '+str(SAMP_SPEED)+'\n\r') | |
#s.write('ADC.SET_RATE '+str(RATE)+'\n\r') # resolution | |
print("SIZE=",SIZE) | |
print("NUM=",NUM) | |
print("RES=",RES) | |
print("RATE=",RATE) | |
print("SAMP_SPEED=",SAMP_SPEED) | |
print("CONV_SPEED=",CONV_SPEED) | |
s.write('ADC.START\n\r') | |
for i in range(0,NUM): | |
print(s.readline()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment