C program to for Rotation of wheel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<conio.h>
#include<dos.h>
 
int xc=50,yc=200,r=35;
int x[15],y[15];
void drawcircles()
{
	setcolor(YELLOW);
	circle(xc,yc,r);
	circle(xc,yc,r+5);
}
void main()
{
	double angle=0,theta;
	int i,a;
	int gd=DETECT,gm;
	initgraph(&gd,&gm,"..\\bgi");
	a=xc+r;
	while(!kbhit())
	{
		while(a<=630)
		{
			theta=M_PI*angle/180;
			cleardevice();
			drawcircles();
			for(i=0;i<18;i++)
			{
				theta=M_PI*angle/180;
				x[i]=xc+r*cos(theta);
				y[i]=yc+r*sin(theta);
				angle+=20;
				line(xc,yc,x[i],y[i]);
			}
			angle+=2; xc+=2; a=xc+r;
			delay(50);
		}
		xc=50;	r=35; a=xc+r;
	}
	getch();
	closegraph();
}

4 Responses to “C program to for Rotation of wheel”

    • Krystal

      guys, there I wrote my first post at WodmBMolsrlog. You can read it here. It was about my feelings when we came to know DDS needed to wear glasses. hush.. I would say no

      Reply
  1. benson mathew

    sir,
    i want to make a circle by using two motor(suppose motor is connected to pen ).one motor is used for moving the pen in horizontal direction and one is for vertical direction. can u help me to do this program.
    hopefully.

    Reply

Leave a Reply