I’m currently trying Arduino C and trying to figure out the best way to convert the given added values into the correct seconds, minutes, and hours. I’m aware this needs division and modulo; it’s just that I’m not sure where. How would I go about doing this?
This is my code:
void setup() {
int swimhours=0;
int swimmins=50;
int swimsecs=59;
int bikehours=2;
int bikemins=50;
int bikesecs=59;
int runhours=1;
int runmins=50;
int runsecs=59;
int totalhours=swimhours+bikehours+runhours;
int totalmins=swimmins+bikemins+runmins;
int totalsecs=swimsecs+runsecs+bikesecs;`
int completehours
int completemins
int completesecs
serial.print
}
void loop() {
}
I need the values of the above to be added (which is the total) and then I need the conversion in the complete variables.
You need to sign in to view this answers
Leave feedback about this