Arduino Mega – Making a Calculator (Serial Port)

In this tutorial I am going to show you how to make a calculator using Arduino Mega 2560 but you can use any Arduino Board. This calculator use only UART module, to communicate with computer. You don´t need any extra parts.


After opening the serial monitor, you should ensure that the 9600 and “newline” are selected, in the options in the bottom bar, as you can see in image below:


As you can see in the code below, there is a function called “serialEvent ()”, this function is recognized by the native libraries of Arduino and therefore the name of this function can not be changed, otherwise it will not be recognized and the system will not work.

Copy the code bellow to your Arduino IDE project and save it. Then open serial monitor of IDE or any other and insert the numbers and operator.

Leave a Reply

Your email address will not be published. Required fields are marked *