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

📄 moverobo.c

📁 一个由c转成java的3D robot 仿真平台
💻 C
字号:
#include "/usr/local/java/include/StubPreamble.h"#include "../RealRobot_SerialOut.h"#include <stdio.h>void RealRobot_SerialOut_moverobo(struct HRealRobot_SerialOut *this, 				  long arm, long pos, long task){    static FILE *datei;    static int fileIsOpen = 0; /* 0 means false */     if (task == 0)      {	/* Open File */		datei = fopen("/dev/ttya","w"); 	fileIsOpen = 1; /* 1 means true */	return;      }    if (task == 1)      {	/* Execute a movement */        if ((arm >= 0) && (arm < 5) && (pos > 0) && (pos < 255))          {	    if (datei != NULL)	      {		fputc(255,datei);		fputc((int)arm,datei);		fputc((int)pos,datei);		fflush(datei);	      }		    else	      {		printf("File is NULL.\n");	      }		  }	return;      }    if (task == 2)      {	/* Close File */	if (fileIsOpen)	  fclose(datei);	return;      }}

⌨️ 快捷键说明

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