/ Trinkey_QT2040_TRNG_Gadget / python / trng_read_csv.py
trng_read_csv.py
 1  # SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import serial
 6  
 7  # open serial port
 8  ss = serial.Serial("/dev/ttyACM0")
 9  
10  # read string
11  _ = ss.readline() # first read may be incomplete, just toss it
12  raw_string = ss.readline().strip().decode()
13  
14  # create list of integers
15  rnd_ints = [int(x) for x in raw_string.split(',')]
16  
17  # print them
18  print(rnd_ints)