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 (NOTE: change location as needed)
 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 floats
15  data = [float(x) for x in raw_string.split(',')]
16  
17  # print them
18  print("CO2 =", data[0])
19  print("pressure =", data[1])
20  print("temperature =", data[2])
21  print("humidity =", data[3])