# circle with radius as parameter

Hi! I've gotten an assignment to program my arduino to go in a circle where the radius is set as parameter. I'm pretty new to C-language. Wondering if anyone out there has an idea on how to solve this assignment?

An Arduino can't go "in a circle" by it's own. So we really need more details. Especially because it's clearly an assignment.

Wondering if anyone out there has an idea on how to solve this assignment?

If you had a car, how would you go about making it go in a 100 m circle? A 200 m circle? What would need to change?

To engage your brain was why you were given the assignment.

Ever heard of a guy called Pythagoras? He was really big about five centuries before Christ.

Interesting puzzle!

Your approach depends on the type of robot/car/whatever you're using.

I assumed two driving wheels that you can run at different speeds (with a free swivelling castor to keep the thing stable), but if yours steers with angled front wheels (like a car) or rear wheels (like a forklift truck) then the approach will be different.

Draw a diagram. Work out what you need to adjust to get different radiuses.

Put that into mathematical language.

Make that into a C program

People here will give you clues if they feel you're trying but won't want to give you a complete solution, because that's a bit like you're cheating.

Good luck!

(I think I just worked out a solution but I didn't use Pythagoras btw :) )

Moving in a circle or calculating a circle given a specific radius has what exactly to do with the C language?

What you'll need are two motors. One stepper connected to a spool of wire, which has one end run to the arduino. You need to know the circumference of the spool so that you can have it unravel a length of wire equal to your input radius parameter. For example, a spool of 6cm circumference would spin one revolution to unravel 6cm of wire. Then the second motor, a fast DC brushed, can be mounted to a secure surface, and its output shaft connected to the first motor. Mind your wiring, run the second motor fast enough, and your arduino will be going in a circle according to the input radius parameter.

If you just want the Arduino to go in a circle you don't need code. Get a piece of string that is the length of the radius. Tie one end to Arduino and hold the other end. Swing it round in a circle.

If that sounds crazy, then you need to add some details to the question.

A radius is only one characteristic of a circle. Others might be the XY co-ordinates of the center, the thickness of the line to draw it etc. etc.
If your assignment is then going to progress on to defining several circles, even of differing radii etc. , you’ll have to think about defining a class, called say Circle, so you can represent different ‘circle’ objects, with all their characteristics.
Then you might want to update your class with methods so, for example, given a particular circle, you could return its area, circumference etc.
Then you might not only want to deal with circles, but maybe squares, triangles etc. so you’d have to expand your class to generic ‘shapes’.

And don’t forget to allow for the curvature of the Earth. A circle 1000km in radius actually has more than 1000km to drive to the point on the earth above the center of the circle.

Honestly, this has got to be one of the worst-specified homework questions I’ve ever seen.

hanelf: Hi! I've gotten an assignment to program my arduino to go in a circle where the radius is set as parameter. I'm pretty new to C-language. Wondering if anyone out there has an idea on how to solve this assignment?

I don't understand - Ardionos don't have wheels.

MorganS:
And don’t forget to allow for the curvature of the Earth. A circle 1000km in radius actually has more than 1000km to drive to the point on the earth above the center of the circle.

Honestly, this has got to be one of the worst-specified homework questions I’ve ever seen.

The old “a man goes 100mi south, 100mi east, 100mi north, and winds up where he started - where is he?” has an infinite number of solutions.

Infinite number besides the North Pole? How do you figure?

PaulMurrayCbr:
The old “a man goes 100mi south, 100mi east, 100mi north, and winds up where he started - where is he?” has an infinite number of solutions.

How do you figure?

CrossRoads: Infinite number besides the North Pole? How do you figure?

An infinite number of planets.

MorganS: An infinite number of planets.

There's a finite number of those

The earth is flat. http://www.theflatearthsociety.org/home/index.php #sarcasm

Near the south pole, where 100 miles east is a full circle, or two full circles, or three, or ...

Can you go south from the South Pole? Or only north?

CrossRoads: Can you go south from the South Pole? Or only north?

Magnetic or geographic?