超声波传感器适用于对大幅的平面进行静止测距。普通的超声波传感器测距范围大概是 2cm~450cm,分辨率3mm(淘宝卖家说的,笔者测试环境没那么好,个人实测比较稳定的 距离10cm~2m 左右,超过此距离就经常有偶然不准确的情况发生了,当然不排除笔者技术 问题。) 测试对象是淘宝上面最便宜的SRF-04 超声波传感器,有四个脚:5v 电源脚(Vcc),触发控制端(Trig),接收端(Echo),地端(GND) 附:SRF 系列超声波传感器参数比较 模块工作原理: 采用IO 触发测距,给至少10us 的高电平信号; 模块自动发送8个40KHz 的方波,自动检测是否有信号返回; 有信号返回,通过IO 输出一高电平,高电平持续的时间就是超声波从发射到返回的时间.测试距离=(高电平时间*声速(340m/s))/2; 电路连接方法 Arduino 程序例子: constintTrigPin = 2; constintEchoPin = 3; floatcm; voidsetup() { Serial.begin(9600); pinMode(TrigPin, OUTPUT); pinMode(EchoPin, INPUT); } voidloop() { digitalWrite(TrigPin, LOW); //低高低电平发一个短时间脉冲去TrigPin delayMicroseconds(2); digitalWrite(TrigPin, HIGH); delayMicroseconds(10); digitalWrite(TrigPin, LOW); cm = pulseIn(EchoPin, HIGH) / 58.0; //将回波时间换算成cm cm = (int(cm * 100.0)) / 100.0; //保留两位小数 Serial.print(cm); Serial.print("cm"); Serial.println(); delay(1000); }
上传时间: 2013-11-01
上传用户:xiaoyuer
设计一个四路数据选择器,其功能是将四组不同的数据按要求选择一个输出.输出的那组数据有两个控制信号决定,其真值表如下: 数据选择控制端 输出的数据 Input0 Input1 output 0 0 output0 0 1 output1 1 0 output 2 1 1 output 3
上传时间: 2015-01-08
上传用户:6546544
Complete support for EBNF notation; Object-oriented parser design; C++ output; Deterministic bottom-up "shift-reduce" parsing; SLR(1), LALR(1) and LR(1) table construction methods; Automatic parse tree creation; Possibility to output parse tree in XML format; Verbose conflict diagnostics; Generation of tree traverse procedures
标签: Object-oriented Deterministic Complete notation
上传时间: 2014-11-29
上传用户:kr770906
(其中已经包含5个源码)所附源程序C或C++代码文件及其可执行文件 Scs.cpp 基本分类算法源程序, 输入数据文件cfile.txt,efile.txt,gfile.txt,pfile.txt ,rfile.txt,tfile.txt Sga.c 基本遗传算法源程序, 输入数据文件input,输出文件output A_life.c 基于遗传算法的人工生命模拟源程序, 输入数据文件world GA_nn.c 基于遗传算法优化神经网络结构源程序,输入数据文件sample Patmat.c 基于遗传算法提取基元图形源程序
上传时间: 2014-01-11
上传用户:13215175592
Tug of War(A tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other the number of people on the two teams must not differ by more than 1 the total weight of the people on each team should be as nearly equal as possible. The first line of input contains n the number of people at the picnic. n lines follow. The first line gives the weight of person 1 the second the weight of person 2 and so on. Each weight is an integer between 1 and 450. There are at most 100 people at the picnic. Your output will be a single line containing 2 numbers: the total weight of the people on one team, and the total weight of the people on the other team. If these numbers differ, give the lesser first. )
上传时间: 2014-01-07
上传用户:离殇
This program can determin very accurately the nature of the user input
标签: accurately the determin program
上传时间: 2015-01-28
上传用户:shinesyh
CRLF Output Stream
上传时间: 2014-07-16
上传用户:13517191407
Write 3270 Session Screen Output to A File
标签: Session Screen Output Write
上传时间: 2014-08-30
上传用户:sssl
This directory contains code implementing the K-means algorithm. Source codemay be found in KMEANS.CPP. Sample data isfound in KM2.DAT. The KMEANSprogram accepts input consisting of vectors and calculates the givennumber of cluster centers using the K-means algorithm. Output isdirected to the screen.
标签: implementing directory algorithm contains
上传时间: 2014-01-27
上传用户:maizezhen
The VideoTransmit class is a simple wrapper that can be programmed to take video input from a source of your choice and transmit the video to a destination computer or network in JPEG format.
标签: VideoTransmit programmed wrapper simple
上传时间: 2014-01-06
上传用户:zhuyibin