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

📄 main.c

📁 PTZ云台控制code,实用与所有的云台控制
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>

#include "ptzimpl.h"
int main(void){

	/*int tty0,tty1,ss0,ss1;
     
	 if( (tty0=open("/dev/ttyS0", O_RDWR | O_NOCTTY)) < 0 )
	{
		printf("ERROR. Open ttyS0 device...\n");		
		//return -1;
	}
	else
		printf("OK. Open ttyS0 device...\n");

	close(tty0);
	 if( (tty1=open("/dev/ttyS1", O_RDWR | O_NOCTTY)) < 0 )
	{
		printf("ERROR. Open ttyS1 device...\n");		
		//return -1;
	}
	else
		printf("OK. Open ttyS1 device...\n");
	close(tty1);
	if( (ss0=open("/dev/tts/2", O_RDWR | O_NOCTTY)) < 0 )
	{
		printf("ERROR. Open ss2 device...\n");		
		//return -1;
	}
	else
		printf("OK. Open ss2 device...\n");
	close(ss0);
	if( (ss1=open("/dev/tts/3", O_RDWR | O_NOCTTY)) < 0 )
	{
		printf("ERROR. Open ss3 device...\n");		
		//return -1;
	}
	else
		printf("OK. Open ss3 device...\n");
	close(ss1);

	/*while(1){
		printf("echo test > /dev/tts/1\n");
		system("echo 1000> /dev/tts/1");
		system("echo 1000> /dev/ttyS1");
		//usleep(10000);
	}*/
	if( Init485() != 0 )
	{
		printf("ERROR. Init 485\n");
		return -1;
	}
	
      int i=20;
	while(1){
	
	DeviceControl(i);
	if(i==0)
	i=20;
	else i--;
	sleep(1);
	}
	
	return 0;
}

⌨️ 快捷键说明

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