⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cam_time1.c

📁 足球机器人自动程序
💻 C
字号:
#include "cam.h"#include <sys/poll.h>#include <sys/time.h>#include <time.h>int main() {	struct timeval tv, tvo;	double t;	struct cam c;	cam_init(&c, 0);	gettimeofday(&tvo, NULL);	cam_capture(&c);	struct pollfd ufds = {c.fd, POLLIN};	int i = 0;	for (; i<300; ++i) {		if (poll(&ufds, 1, -1) <= 0) {			fprintf(stderr, "poll error\n");			return -1;		}		cam_sync(&c);		gettimeofday(&tv, NULL);		t = tv.tv_sec - tvo.tv_sec;		t += (double)(tv.tv_usec - tvo.tv_usec) / 1e6;		tvo = tv;		printf("%f\n", t);		cam_capture(&c);	}	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -