linux下kbhit()函数 getch函数。

linux下kbhit()函数 getch函数。 怎样在C语言执行循环程序时按键盘任意键停止程序,再按再继续执行? 参考http://zhidao.baidu.com/question/272086855.html 在linux下C语言写了一个while循环,怎么实现按任意键退出。如何编写程序? 参考:http://zhidao.baidu.com/question/461121586.html 对于上面的问题,都用到 linux下的getch函数与kbhit函数。 参考了http://kpld8888.wordpress.com/2007/03/07/linux%E4%B8%8B%E7%9A%84getch%E5%87%BD%E6%95%B0%E4%B8%8Ekbhit%E5%87%BD%E6%95%B0-2/ 和:http://zhidao.baidu.com/question/461121586.html 但是我照搬上面两条都不能很好的编译,总是有错误。奉上我的文件: 将下列三个文件放在工程目录下,build project即可。 main.c: 1. #include "kbhit.h" 2. #include <stdio.h> 3. #include <stdlib.h> 4. #include "accelerometer.h" //contains the middle level macros, state variable 5. // definition and declaration for the 6. //middle layer (class layer) functions 7. 8. 9. 10. void delay(int a){ 11. int i,j,delay; 12. for(i = 0 ; i < 1170*(200/a); i++){ 13. delay = 0; 14. for(j = 0; j < 100; j++){ 15. delay = delay+1; 16.

READ MORE

MATLAB 3D 动画制作(一、二、三)

MATLAB 3D 动画制作(一)- 3D 图形设计 MATLAB 3D Animation – 3D object design Auther: Sonictl Northeastern University. 前言:本系列教程将逐步完成一个有趣的MATLAB 3D动画,MATLAB 3D图形的绘制和3D动画的制作可以让工程人员很直观地展示工作内容,特别是在虚拟现实,控制系统设计,人机交互,计算机视觉,等领域都能得到应用。 Introduction: This series of tutorials are going to discuss a process of making 3D animation using MATLAB step by step. The 3D animation in MATLAB can let the engineers exhibit their work. It can be used widely, especially at the fields of Virtual Reality, Control system Designing, Human-machine interactivity, Computer Vision, etc. 首先介绍一下本教程的最终效果: Below is the final effect of this 3D animation.

READ MORE

MATLAB 3D 动画制作(三)- 实时随动3D动画设计

MATLAB 3D 动画制作(三)- 实时随动3D动画设计 MATLAB 3D 动画制作(三)- 实时随动3D动画设计 MATLAB 3D Animation – Real-time 3D Animation Design Author: Sonictl Northeastern University. 前言:本教程将逐步完成一个有趣的MATLAB 3D实时随动动画, 本篇将使用串口数据实时控制动画中的物体的运动。“MATLAB 3D 动画制作(三)- 实时随动3D动画设计” 是 “MATLAB 3D 动画制作(二)- 3D 动画动作设计” 的进阶篇。 本篇将使用串口数据实时控制动画中的物体的运动。 Introduction: This series of tutorials are going to discuss a process of making 3D animation using MATLAB step by step. The 3D animation in MATLAB can let the engineers exhibit their work. It can be used widely, especially at the fields of Virtual Reality, Control system Designing, Human-machine interactivity, Computer Vision, etc.

READ MORE

MATLAB 3D 动画制作(二)- 3D 动画动作设计

MATLAB 3D 动画制作(二)- 3D 动画动作设计 MATLAB 3D 动画制作(二)- 3D 动画动作设计 MATLAB 3D Animation – 3D Animation Action Design Auther: Sonictl Northeastern University. 前言:本系列教程将逐步完成一个有趣的MATLAB 3D动画,MATLAB 3D图形的绘制和3D动画的制作可以让工程人员很直观地展示工作内容,特别是在虚拟现实,控制系统设计,人机交互,计算机视觉,等领域都能得到应用。 MATLAB 3D 动画制作(二)- 3D 动画动作设计 是 MATLAB 3D 动画制作(一)- 3D 图形设计 的进阶篇。 Introduction: This series of tutorials are going to discuss a process of making 3D animation using MATLAB step by step. The 3D animation in MATLAB can let the engineers exhibit their work. It can be used widely, especially at the fields of Virtual Reality, Control system Designing, Human-machine interactivity, Computer Vision, etc.

READ MORE

MATLAB 3D 动画制作(一)- 3D 图形设计

MATLAB 3D 动画制作(一)- 3D 图形设计 MATLAB 3D 动画制作(一)- 3D 图形设计 MATLAB 3D Animation – 3D object design Auther: Sonictl Northeastern University. 前言:本系列教程将逐步完成一个有趣的MATLAB 3D动画,MATLAB 3D图形的绘制和3D动画的制作可以让工程人员很直观地展示工作内容,特别是在虚拟现实,控制系统设计,人机交互,计算机视觉,等领域都能得到应用。 Introduction: This series of tutorials are going to discuss a process of making 3D animation using MATLAB step by step. The 3D animation in MATLAB can let the engineers exhibit their work. It can be used widely, especially at the fields of Virtual Reality, Control system Designing, Human-machine interactivity, Computer Vision, etc. 首先介绍一下本教程的最终效果: Below is the final effect of this 3D animation.

READ MORE

MATLAB 3D 动画简单实例

MATLAB 3D 动画简单实例 MATLAB 3D 动画简单实例 翻译自网站: http://www.matrixlab-examples.com/simple-animation-3d.html 本文是在系统学习MATLAB绘图(2D-3D)之前的一个引例。 系统学习资料在: MATLAB 2-D and 3-D 绘图 望喜欢! 本文将展示2个使用MATLAB制作的简单的3D动画。在第一个例子中,我们对一个球体sphere进行动画制作,旋转了观察的角度,但没有改变物体形状。 在第二个例子中,我们画了一个抛物面paraboloid,并且改变了它的大小和形状。这些简单的技术是MATLAB动画制作的基础。 1. 球体的动画 首先我们绘制了一个球体,并且保证3D坐标系的比例是正常的。然后,变换我们观察的角度,从方位角和高度进行了改变。整个过程不改变球体形状大小,只是改变视角。 ‘drawnow’语句作用就是更新当前的图形。它冲掉了queue事件,强行让MATLAB更新屏幕。 完成以上功能的代码如下: clear; clc; close all % Draw a sphere sphere % Make the current axis box square in size axis('square') % Define title and labels for reference title('Rotation of a sphere...') xlabel('x'); ylabel('y'); zlabel('z') % Modify azimuth (horizontal rotation) and update drawing for az = -50 : .2 : 30 view(az, 40) drawnow end % Modify elevation (vertical rotation) and update drawing for el = 40 : -.

READ MORE

MATLAB 3D 动画简单实例

MATLAB 3D 动画简单实例 MATLAB 3D 动画简单实例 翻译自网站: http://www.matrixlab-examples.com/simple-animation-3d.html 本文是在系统学习MATLAB绘图(2D-3D)之前的一个引例。 系统学习资料在: MATLAB 2-D and 3-D 绘图 望喜欢! -—————– 本文将展示2个使用MATLAB制作的简单的3D动画。在第一个例子中,我们对一个球体sphere进行动画制作,旋转了观察的角度,但没有改变物体形状。 在第二个例子中,我们画了一个抛物面paraboloid,并且改变了它的大小和形状。这些简单的技术是MATLAB动画制作的基础。 球体的动画 首先我们绘制了一个球体,并且保证3D坐标系的比例是正常的。然后,变换我们观察的角度,从方位角和高度进行了改变。整个过程不改变球体形状大小,只是改变视角。 ‘drawnow’语句作用就是更新当前的图形。它冲掉了queue事件,强行让MATLAB更新屏幕。 完成以上功能的代码如下: -————————– clear; clc; close all % Draw a sphere sphere % Make the current axis box square in size axis('square') % Define title and labels for reference title('Rotation of a sphere...') xlabel('x'); ylabel('y'); zlabel('z') % Modify azimuth (horizontal rotation) and update drawing for az = -50 : .2 : 30 view(az, 40) drawnow end % Modify elevation (vertical rotation) and update drawing for el = 40 : -.

READ MORE

三轴力传感器数据在MATLAB中实时显示

三轴力传感器数据在MATLAB中实时显示 演示视频: http://v.youku.com/v_show/id_XNTAwODg3Njc2.html 使用了嵌入式PAL Board作为数据采集装置,搭载ADI公司的ADXL345三轴力传感器。使用串口RS232传输数据到MATLAB,MATLAB建立串口对象,每上来一组数据就调用一次回调函数。回调函数实现绘图的功能。Enjoy! 本例程是修改自:MATLAB动画显示串口数据【实例】 Display the real-time data acquired form 3-axis accelerometer sensor in MATLAB Demo video: http://www.youtube.com/watch?v=YoBn7LAtDrU Used the embedded PAL board to capture the accelerometer data. The board contains the 3-axis accelerometer sensor ADXL345 produced by Analog Devices. Sent the data to MATLAB through serial port. Built the serial object in MATLAB. Call the callback function when the data generated. The callback function realize the plotting function. Enjoy! Explorer More: MATLAB 3D 动画制作(一)- 3D 图形设计

READ MORE

三轴力传感器数据在MATLAB中实时显示

2013-01-12_三轴力传感器数据在MATLAB中实时显示 演示视频: http://v.youku.com/v_show/id_XNTAwODg3Njc2.html 使用了嵌入式PAL Board作为数据采集装置,搭载ADI公司的ADXL345三轴力传感器。使用串口RS232传输数据到MATLAB,MATLAB建立串口对象,每上来一组数据就调用一次回调函数。回调函数实现绘图的功能。Enjoy! 本例程是修改自:MATLAB动画显示串口数据【实例】 Display the real-time data acquired form 3-axis accelerometer sensor in MATLAB Demo video: http://www.youtube.com/watch?v=YoBn7LAtDrU Used the embedded PAL board to capture the accelerometer data. The board contains the 3-axis accelerometer sensor ADXL345 produced by Analog Devices. Sent the data to MATLAB through serial port. Built the serial object in MATLAB. Call the callback function when the data generated. The callback function realize the plotting function. Enjoy! Explorer More: MATLAB 3D 动画制作(一)- 3D 图形设计

READ MORE

Fedora-Ubuntu 修改字体方法

Fedora-Ubuntu 修改字体方法 fedora(Ubuntu)下安装新字体倒也简单。 1.首先下载你喜欢的字体,后缀名应该是ttf, 2.然后将文件或文件夹拷贝到linux中/usr/share/fonts目录下,你也可以在该目录下新建子目录,如:sudo mkdir -p chinese/yahei 3.在/usr/share/fonts/chinese目录下执行下面3条语句。(关于3条语句功能,可搜索之。) 1. sudo mkfontscale 2. sudo mkfontdir 3. sudo fc-cache -fv 4.安装完以后注销,再次登陆字体就可用了,但是要设置字体,我们还需要安装一个工具gnome-tweak-tool,傻瓜式安装: sudo yum install gnome-tweak-tool 5.然后应用程序里多了一项"高级设置",打开它就可以设置字体了,也可以在终端输入gnome-tweak-tool打开。设置字体是傻瓜式的,这里不再废话,重要的是如何设置字体,使得中文使用微软雅黑字体,英文使用Ubuntu Mono(或者你喜欢的其他英文字体,Monaco也是一个很不错的编程字体) 你可以在最适合编程的十大字体里面选择一个你特别喜欢的,或者像我一样使用Ubuntu Mono字体,然后按照上面的方法安装新字体,打开gnome-tweak-tool这个工具,进行如下设置: 这样设置以后就可以实现中文使用微软雅黑,英文使用更适合编程的字体了,这里要友情提醒的是,终端--配置文件首选项--常规选项卡里也是可以修改字体的,不过新安装的字体不在里面,只能修改成系统自带的字体,所以这里最好使用默认设置。 参考:https://github.com/lalor/note/blob/master/fedoraFAQ.md

READ MORE