title: how to read multiple values from com port using pyserial with python?
body: <p>I have an STM32 connected to a thermal sensor which indicate the temperature of the room and i worte this program to read this temperatur from my com port. Now i need a program to read multiple value from my com port.
  thank you for helping me to solve this problem.</p>
  <pre><code>import serial
  
  serport = 'COM3'
  serbaudrate = 38400
  ser = serial.Serial(port = serport, baudrate = serbaudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, timeout=2)
  try:
      ser.isOpen()
  except:
      print(&quot;Error&quot;)
      exit()
  
  if ser.isOpen():
      try:
          while 1:
              if ser.inWaiting() &gt; 0:
                  #print(ser.readline())
                  response = ser.readline()
                  print(response.decode(&quot;utf-8&quot;))
  
              else:
                  ser.write(b&quot;1&quot;)
      except Exception as e:
          print(e)
  </code></pre>
  <p>@Tarmo thank you for answering my question. This is the code i wrote for programming th microcontroller:</p>
  <pre><code>while (1)
        {
    // Test: Set GPIO pin high
      HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
  
      // Get ADC value
      HAL_ADC_Start(&amp;hadc1);
      HAL_ADC_PollForConversion(&amp;hadc1, HAL_MAX_DELAY);
      raw = HAL_ADC_GetValue(&amp;hadc1);
      raw = ((raw*0.000244*3.3) - 0.25)/0.028;
      HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_RESET);
  
      // Convert to string and print
      sprintf(msg, &quot;%hu\r\n&quot;, raw);
      HAL_UART_Transmit(&amp;huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
      // Pretend we have to do something else for a while
      HAL_Delay(100);  
      }
  </code></pre>
  <p>in this case i am reading just one value because the thermal sensor gives only one value. if i have more than one value how can i delimit them with a semicolon?</p>