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 14:00
Which database model is best used for data warehouse and data mining
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
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
English, 10.05.2021 19:00
question
Mathematics, 10.05.2021 19:00
question
Mathematics, 10.05.2021 19:00
Questions on the website: 13722359