PIC Vietnam

Go Back   PIC Vietnam > Robotics > Công nghệ robot

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

Công nghệ robot Tất cả các vấn đề về robot di động, tay máy, haptics....

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 11-08-2011, 11:17 PM   #5
tahi
Đệ tử 4 túi
 
Tham gia ngày: Mar 2009
Bài gửi: 64
:
mắt tinh: cảm biến tốt
chân khỏe: động cơ ngon
1 cái đầu thông minh: code tốt
1 cái đầu thông minh sẽ đỡ 1 phần cho cái mắt kém, và 1 cái chân yếu
Em viết dò đường hay viết theo kiểu máy trạng thái đơn giản

Code:
void read_sensor()
{
}
void direct(int mode)
{
	//set up direct for motor controller 
}
void speed(unsigned int motor1,unsigned int motor2)
{
	//justify speed of left and right motor
}
main()
{
	direct(forward);
	speed(100,100);
	while(1)
	{
		switch(partern)
		{
			case wait:
				//waiting user press any button
			case straight:
				switch(read_sensor())
					case 0000 0000:
						partern = straight;
						break;
					case xxx0 0xxx:
						//A little inclined to the left
					case 0000 xxxx:
						partern = turn_left;
						break;
					case xxxx xxxx:
						partern = out_road;
			case turn_left:
				direct(forward);
				toc_do(20,100);
				partern = straight;
				break;
			case turn_right:
				break;
			case check_crossline:
				break;
			case out_road:
				direct(back);
				speed(100,100);		
				break;
		}
	}
}

thay đổi nội dung bởi: tahi, 11-08-2011 lúc 11:24 PM.
tahi vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 12:39 AM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam