/ Trinkey_QT2040_TRNG_Gadget / python / trng_read_raw.py
trng_read_raw.py
 1  # SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import serial
 6  
 7  # how many bytes to read?
 8  TRNG_SIZE = 4
 9  
10  # open serial port
11  ss = serial.Serial("/dev/ttyACM0")
12  
13  # read raw bytes
14  raw_bytes = ss.read(TRNG_SIZE)
15  
16  # print them
17  print(raw_bytes)