October 22, 2024
Chicago 12, Melborne City, USA
C#

Arduino C reading multiple inputs


I am currently trying to read inputs and store them into integers however im struggling in making them display in an order.

I was hoping the code would display one after another however once i input a value into the serial monitor it displays all the text.

I believe its to do with the positioning of the serial.println however

this is the code:

Serial.println("please input a swim hour");
while (!Serial.available()) {
//wait for a the user to enter a value
;
int swimhours=Serial.parseInt();
}

I need to print this out 8 more times. How would i turn this into a function? so that once i input a value, the next line of text will appear which would be "please input a swim minute" and then store it.

I need the text to be on all these integers:

int swimmins;
int swimsecs;
int swimhours;
int bikehours;
int bikemins;
int bikesecs;
int runhours;
int runmins;
int runsecs; 



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video