This project is a beginner-friendly Arduino sketch designed to demonstrate how the Serial Monitor works in real-time. It calculates and displays the area of a circle using a simple mathematical formula, with the radius increasing on each loop.
Every second, the program:
- Calculates the area of a circle using the formula Area = Ο Γ rΒ²
- Increases the radius by 1 unit
- Prints a message to the Serial Monitor that includes both the radius and its corresponding area
This continues infinitely, providing a growing list of circle areas as the radius grows. It's a great way to get familiar with:
- Using the Serial Monitor for output
- Performing arithmetic with floating point numbers
- Declaring and manipulating different data types (
float
,int
,String
)
Below is an example of what you would see in the Arduino Serial Monitor:
A circle of radius 2 Has an area of 12.56
A circle of radius 3 Has an area of 28.26
A circle of radius 4 Has an area of 50.24
A circle of radius 5 Has an area of 78.5
A circle of radius 6 Has an area of 113.04
...
The output continues as long as the Arduino board is running.
Here are a few ideas to take this project further:
- Limit the radius growth and reset it after a certain value to avoid overflow.
- Use the
PI
constant from themath.h
library for more precision. - Display the values on an LCD or OLED screen instead of the Serial Monitor.
- Add user interaction using buttons or a potentiometer to control the radius.
- Store values in EEPROM to log radius-area data even after reset.
This simple program was mainly used to practice printing dynamic content to the Serial Monitor and working with basic variables. It serves as a fun and clear way to get started with Arduino coding.
Feel free to fork this repo and build your own version of it!