long number1; // first number of the calculation, sent through the Serial monitor. If you take a look, it's a long varible, so we're able to use big numbers long number2; // second number sent through the SM char operation; // create a char variable to store the calcuation signal. long result; // result of the calculation int ledPin = 13; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); // begins serial communications Serial.println("What should I calculate? (For example: 2+3)"); Serial.println(); } void loop() { while(Serial.available() > 0) { // while there is data being sent to arduino, number1 = Serial.parseInt(); operation = Serial.read(); // calSignal will be the first char after the first number number2 = Serial.parseInt(); // stores the second number in number2 calculate(); // Custom function to perform the calculations Serial.print("Result = "); Serial.println(result); // Prints the result of the calculation Serial.println("Done..."); // prints Serial.println(); // jumps a line blinkresult (result); } } void calculate() { // Custom function that performs the calculations if (operation == '+') { result = number1 + number2; } else if (operation == '-') { result = number1 - number2; } else if (operation == '*') { result = number1 * number2; } else if (operation == '/') { result = number1 / number2; } else { Serial.println("Error, Wrong input!!"); Serial.println(); result = 0; } } void blinkresult (int result) { for (int i=1; i<=result; i++) { digitalWrite (13, HIGH); delay (1000); digitalWrite (13, LOW); delay(1000); } }