To calculate the area of circle

Hello
How to calculate the area of circle using arduino board. The circle was full of black colour so How to calculate the area.
Please can any one help me about this project.

Area is Pi*r^2

using arduino how to calculate the area

using arduino how to calculate the area

float areaOfCircle = radius * radius * PI;

DO NOT CROSS-POST.
Your duplicate post has been removed to save anyone wasting their time.

I'm asking logic how to calculate the area.
The area should displayed in LCD.
The circle is full of black colour.

Hello and welcome,

AWOL gave you already the "logic" but if that's not what you want you will have to explain more what you want to do exactly because we can't read in your mind...

Do you mean, calculate the area of a circle that is drawn on paper?

The area should displayed in LCD.

Serial.println (areaOfCircle);

My 24 inch monitor is an LCD. :wink:

The circle is full of black colour.

So, measure the diameter.
Divide the diameter by two and square it.
Multiply the result by pi.

The project iam doing is SRCC in which my robot has to travel on a white surface to reach a circle of black colour with unknown dimensions.
The circle will have different coloured boxes from which the robot have to pick the black box and come to the starting point and then go back to the circle and travel along the circumference and find its area and display.

The project iam doing is SRCC

And we're supposed to know what that is?

You haven't told us anything about your robot, or any other constraints or special features.

If you can express the device's position in Cartesian coordinates as it traces the outline of any closed figure, the problem is trivial.

mandakini:
The project iam doing is SRCC in which my robot has to travel on a white surface to reach a circle of black colour with unknown dimensions.
The circle will have different coloured boxes from which the robot have to pick the black box and come to the starting point and then go back to the circle and travel along the circumference and find its area and display.

Yes, the problem is much easier to understand when you give us your full project description. So, judging by your question the only part you have trouble with is calculating the area of a circle after your robot has navigated around it?

You need to have your robot know its position in some coordinate system - cartesian coordinates would be easiest to work with. You could use dead reckoning for this if you don't have any other means. Record the min and max coordinates on one axis; this gives you the diameter. Square it, divide by four, multiply by Pi and the answer is the area of the circle in the units of your coordinate system. If those aren't the units you were required to give the area in then obviously you need to convert to the correct units by multiplying by the appropriate scale factor.

To calculate the area of an arbitrary figure goes something like:
Set an appropriately-sized accumulator to zero.
As you trace the outline of the figure, calculate the area of the trapezoid under the curve (((x1 - x0) times (y0 + y1)) / 2) from the last point to the current point, and add the area to the accumulator (the area may be negative remember).
As soon as you reach the start point again, the absolute value of the accumulator is the area of the figure.
You don't even need floats, just maintain one extra bit of precision in the accumulator.

Please do not cross post, and also do not fire off your questions to us by personal message.

This sounds like a homework assignment, and asking multiple times on the forum for assistance, and then also sending the exact same question in personal messages is an abuse of the process.