コード例 #1
0
ファイル: navigation.c プロジェクト: asabeeh18/Embedded-C
int main()
{
	int i=0;
	init_devices();
	lcd_set_4bit();
	lcd_init();
	color_sensor_scaling();
	/*
	//variable 'i' scales at 13,14 for sharp sensor for velocitty 240 240
	//u turn 1600ms at 200,200 velocity
	velocity(200,200);
	left();
	_delay_ms(1600);
	stop();
	while(1);
	
	threshold=6000;
	
	right();
	while(ADC_Conversion(11)<65)
	{
		i++;
		lcd_print(1,11,i,3);
	}
	stop();
	lcd_print(2,11,scan(),1);
	stop();
	while(1);
	*/
	setIndicatorAndColor();
	threshold=6000;
	ct = 0; adj = 2;
	//lcd("Begin");
	while (sorted<total)
	{
		canDrop();
		//buzzer_on();
		//_delay_ms(500);
		//buzzer_off();
		if (visitedCount == 3)
			predict();
		if (sorted == total)
			break;
		pickup();
		traverseToSort(ct, ct % 2 + 4);
		sortCheck();
	}
	for (i = 0; i<4; i++);
		//..printf("%d %d\n", term[i][0], term[i][1]);
	//..printf("Sort 0=%dSort 1=%d\nArm 0=%dArm 1=%d\n", sort[0], sort[1], arm[0], arm[1]);
	//..printf("Cost=%d\nSORTED!!!!!\n", cost + 7);
	//getch();
	return 0;
}
コード例 #2
0
ファイル: DIR4 (3).C プロジェクト: asabeeh18/PROgrammin
int main()
{
	int i;
	setIndicatorAndColor();
	ct=0;adj=2;
	while(sorted<total)
	{
		canDrop();
		if(visitedCount==3)
			predict();
		if(sorted==total)
			break;
		pickup();
		traverseToSort(ct,ct%2+4);
		sortCheck();
	}
	for(i=0;i<4;i++)
		printf("%d %d\n",term[i][0],term[i][1]);
	printf("Sort 0=%dSort 1=%d\nArm 0=%dArm 1=%d\n",sort[0],sort[1],arm[0],arm[1]);
	printf("Cost=%d\nSORTED!!!!!\n",cost+7);
	//getch();
	return 0;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: anfleene/362
int main (){
	vector<vector<short> >*mat = new vector<vector<short> >();
	//r
	int row = 4000;
	//s
	int column = 25;
	//load the matrix
	loadMatrixFromFile("Lab9.txt", row, column, mat);
	Matrix *matrx = new Matrix(mat, row, column);
	ColumnSorter *cols =	new ColumnSorter(matrx);
	//start the timer
	Timer a_timer = Timer();
	//sort
	cols->sort();
	//calc the elapsed time
	double elapsed = a_timer.elapsed_time();
	//if sorted print the matrix and time elapsed
	if(sortCheck(cols->mat)){
			print_matrix(cols->mat, "result.txt", elapsed);
	}else{
		cout << "The matrix is not sorted" << endl;
	}
	return 0;
}