Port switches when Bootloader was opened

The Wio Terminal is on Port COM3, I can’t load the program and it loades endless. If I open the bootloader the port switches automaticly to COM4, if I now try to load the program the port Switches back to COM3 but it loades the program. But now it’s the same problem again. If the program is loaded I also can’t open the serial monitor becaus it cant find port COM3.

During boot mode, wio terminal will appear on the PC drive, so if you copy the uf2 file created from the bin file there,
You can rewrite wio terminal. (In my case, the drive name was arduino.)
Why not try this method?

  1. Create a bin file (ArduinoIDE Sketch→Export compiled Binary)
  2. Open ”https://seeedjp.github.io/uf2/”
  3. Enter 0x4000 in Address to read the bin file and save the uf2 file.
  4. Put wio terminal into boot mode
  5. Copy the uf2 file to the newly appeared drive on your PC
  6. The wio terminal program will be rewritten.

I have tried that already for the other programs it works(it still switches the port but I can load the program) but not for the one I’m working on. Maybe it’s a problem in the code?
#include “TFT_eSPI.h”
#include “Multichannel_Gas_GMXXX.h”
#include “Wire.h”

TFT_eSPI tft;
#define ROTARY_ANGLE_SENSOR A0 /* pin of rotary angle sensor */

unsigned long startTime = 0;
const unsigned long alarmDelay = 20000; // 20 seconds delay for the alarm

bool buzzerActive = false; // Buzzer status

void setup() {
Serial.begin(115200); // Start Serial Communication

void loop() {
int val = gas.getGM702B();
Serial.print("CO2 Value: ");

int sensorValue = analogRead(ROTARY_ANGLE_SENSOR); // Read value from the Rotary Angle Sensor
int mappedValue = map(sensorValue, 0, 1023, 0, 999); // Map the value to the CO2 range

// Manually control the CO2 value
val = mappedValue;

if (val <= 220) {
// CO2 value below 220, reset everything
tft.fillScreen(TFT_BLUE); // Set screen color to blue
if (!buzzerActive) {
analogWrite(WIO_BUZZER, 0); // Turn off the buzzer if it’s not active
startTime = 0; // Reset start time
} else {
if (startTime == 0) {
startTime = millis(); // Set start time when CO2 value goes above 220
} else if (buzzerActive && val <= 220) {
// Deactivate the alarm when CO2 value goes back below 220
startTime = 0; // Reset the start time

if (!buzzerActive && millis() - startTime >= alarmDelay) {
  activateAlarm(); // Activate the alarm after 20 seconds


if (digitalRead(WIO_KEY_C) == LOW && buzzerActive) {
// Turn off the buzzer but keep the warning message if the button is pressed
analogWrite(WIO_BUZZER, 0);
buzzerActive = false;

void activateAlarm() {
tft.setCursor(100, 100);
analogWrite(WIO_BUZZER, 128);
buzzerActive = true; // Set the buzzer status to active

I was able to fix it, it was a problem in the code. I fergot to use the hardware I2C.

void setup(){

gas.begin(Wire, 0x08);


Manually reset the Wio Terminal by pressing the reset button on the board before attempting to upload your program. This ensures that the board is in the bootloader mode.