Serial Read not waiting

Hi I’m trying to do so user input via serial.
What i want to acheive i want to connect via usb press a button and ill run a function that serial prints a list of options, then serial read what option was selected and perform that function.

but two thing either happen i just print out my list forever or it doesnt see the serial read and exit the function.
i know ive got to wait for the serial read but i just cant seem to figure it out.
Ive tried while(serial.availble) while not equal to my options.

my code
im using vscode, boron firmware 3.3.0

  Serial.printf("1) Channel 1\n");
  Serial.printf("2) Channel 2\n");
  Serial.printf("3) Quit\n");
  response = Serial.read();
  switch (response) {
     case '1':
     Serial.printf("Running Calibration on channel 1\n");
     runcalibration_one();
     break;
     case '2':
     Serial.printf("Running Calibration on channel 2\n");
     //runcalibration_two();
     break;
     case '3':
     Serial.print("Quiting");
     break;

     default:
     response = Serial.read();
  }

Issue seem to be with vscode, wirked when i used putty

The Particle Workbench serial monitor and the Particle CLI particle serial monitor are one-way. You can only monitor output from the Particle device, you cannot type to it. Using PuTTY, Coolterm, or screen (Mac or Linux) are the best options.

Thanks Rickkas, ive found it work via putty thanks for confirming

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.