subject

Modify the program so that it can do any prescribed number of multiplication operations (at least up to 25 pairs). The program should have the user first indicate how many operations will be done, then it requests each number needed for the operations. When complete, the program should then return "done running" after displaying the results of all the operations in order. It is in the Arduino Language

You can write the code from scratch if you'd like without modifying the given code. In any expected output.

//Initializing the data
float num1 = 0;
float num2 = 0;
int flag1 = 0;

// a string to hold incoming data
String inputString = " ";
// Whether the string is Complete
boolean stringComplete = false;
//This is where the void setup begins
void setup() {
//Initializing the serial
Serial. begin (9600);
//Reserving 200 bytes for the inputString
inputString. reserve (200);
Serial. println("Provide The First Number");
}

void loop() {
//Print the string when the new line arrives
if (stringComplete) {
if (flag1 == 0) {
Serial. println(inputString);
num1 = inputString. toFloat( );
flag1 = 1;
//Asking the user to input their second string
Serial. println("Provide The Second Number");
}
else if (flag1 == 1) {
Serial. println(inputString);
num2 = inputString. toFloat( );
flag1 = 2;
Serial. println("The Product is Calculating...");
}
if (flag1 == 2) {
Serial. println("The Product is: ");
Serial. println(num1*num2);
Serial. println("Press Reset");
flag1 = 5;
}
//This clears the string
inputString = " ";
stringComplete = false;
}
}

void serialEvent() {
while (Serial. available( )) {
// get the new byte
char inChar = (char)Serial. read( );
//add it to the inputString
inputString += inChar;
//if the incoming character is a newline, set a flag so the main loop can
//do something about it

if (inChar == '\n') {
stringComplete = true;
}
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 24.06.2019 19:50
How to unblock on chrome book? ?
Answers: 1
question
Computers and Technology, 24.06.2019 22:50
Which of these might be an example of an advertiser's target group? a.people who have no access to media b.people the advertisers know nothing about c. people who watch a variety of tv shows d. people who live in the same region of the country
Answers: 2
question
Computers and Technology, 25.06.2019 04:30
If you have watched pretty little liars(pll)what are the names of the main characters? all of them and the boyfriends and girlfriends too.
Answers: 2
You know the right answer?
Modify the program so that it can do any prescribed number of multiplication operations (at least up...
Questions
question
Biology, 03.07.2019 00:00
question
Advanced Placement (AP), 03.07.2019 00:00
question
Geography, 03.07.2019 00:00