use stream object for input, compatible with both HardwareSerial and SoftwareSerial