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();
}