Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I ALREADY SENT THIS QUESTION, BUT THEY ASNWERED ME WITH A WRONG CODE with a lot

ID: 3742248 • Letter: I

Question

 I ALREADY SENT THIS QUESTION, BUT THEY ASNWERED ME WITH A WRONG CODE with a lot of errors , IF YOU GUYS COULD HELP ME and verify that the code runs correctly LANGUAGE: ARDUINO WITH ARDUINO... Build a program that allows three data to be read through the serial port: a range specified by the lower limit and the upper limit and a number N that is within the range. He program determines all numbers in the range that are multiples of N, for example: Lower limit: 1 Upper limit: 10 N: 3 The program should indicate: The multiples of 3 are: 3 6 9 Points to consider: a) The program should include the function called bool multiples (int x, int N) that calculates if x is a multiple of N, if it is true, otherwise returns false. b) Call the sketch MultiploesN

Explanation / Answer

Answer:

void setup() {
Serial.begin(9600);
}

unsigned int test=0;
char incomingByte;

void loop() {
if (Serial.available() > 0) {
    test = 0;       
    while(1) {          
      comingByte= Serial.read();
      if (comingByte== ' ') break;
      if (comingByte== -1) continue;
      test *= 10;
   
      test = ((comingByte- 48) + test);
    }
    Serial.println(test);
}
}