超聲波傳感器適用于對(duì)大幅的平面進(jìn)行靜止測(cè)距。普通的超聲波傳感器測(cè)距范圍大概是 2cm~450cm,分辨率3mm(淘寶賣家說的,筆者測(cè)試環(huán)境沒那么好,個(gè)人實(shí)測(cè)比較穩(wěn)定的 距離10cm~2m 左右,超過此距離就經(jīng)常有偶然不準(zhǔn)確的情況發(fā)生了,當(dāng)然不排除筆者技術(shù) 問題。) 測(cè)試對(duì)象是淘寶上面最便宜的SRF-04 超聲波傳感器,有四個(gè)腳:5v 電源腳(Vcc),觸發(fā)控制端(Trig),接收端(Echo),地端(GND) 附:SRF 系列超聲波傳感器參數(shù)比較 模塊工作原理: 采用IO 觸發(fā)測(cè)距,給至少10us 的高電平信號(hào); 模塊自動(dòng)發(fā)送8個(gè)40KHz 的方波,自動(dòng)檢測(cè)是否有信號(hào)返回; 有信號(hào)返回,通過IO 輸出一高電平,高電平持續(xù)的時(shí)間就是超聲波從發(fā)射到返回的時(shí)間.測(cè)試距離=(高電平時(shí)間*聲速(340m/s))/2; 電路連接方法 Arduino 程序例子: constintTrigPin = 2; constintEchoPin = 3; floatcm; voidsetup() { Serial.begin(9600); pinMode(TrigPin, OUTPUT); pinMode(EchoPin, INPUT); } voidloop() { digitalWrite(TrigPin, LOW); //低高低電平發(fā)一個(gè)短時(shí)間脈沖去TrigPin delayMicroseconds(2); digitalWrite(TrigPin, HIGH); delayMicroseconds(10); digitalWrite(TrigPin, LOW); cm = pulseIn(EchoPin, HIGH) / 58.0; //將回波時(shí)間換算成cm cm = (int(cm * 100.0)) / 100.0; //保留兩位小數(shù) Serial.print(cm); Serial.print("cm"); Serial.println(); delay(1000); }
上傳時(shí)間: 2013-11-01
上傳用戶:xiaoyuer
設(shè)計(jì)一個(gè)四路數(shù)據(jù)選擇器,其功能是將四組不同的數(shù)據(jù)按要求選擇一個(gè)輸出.輸出的那組數(shù)據(jù)有兩個(gè)控制信號(hào)決定,其真值表如下: 數(shù)據(jù)選擇控制端 輸出的數(shù)據(jù) Input0 Input1 output 0 0 output0 0 1 output1 1 0 output 2 1 1 output 3
標(biāo)簽: Input0 Input1 output 數(shù)據(jù)
上傳時(shí)間: 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
標(biāo)簽: Object-oriented Deterministic Complete notation
上傳時(shí)間: 2014-11-29
上傳用戶:kr770906
(其中已經(jīng)包含5個(gè)源碼)所附源程序C或C++代碼文件及其可執(zhí)行文件 Scs.cpp 基本分類算法源程序, 輸入數(shù)據(jù)文件cfile.txt,efile.txt,gfile.txt,pfile.txt ,rfile.txt,tfile.txt Sga.c 基本遺傳算法源程序, 輸入數(shù)據(jù)文件input,輸出文件output A_life.c 基于遺傳算法的人工生命模擬源程序, 輸入數(shù)據(jù)文件world GA_nn.c 基于遺傳算法優(yōu)化神經(jīng)網(wǎng)絡(luò)結(jié)構(gòu)源程序,輸入數(shù)據(jù)文件sample Patmat.c 基于遺傳算法提取基元圖形源程序
上傳時(shí)間: 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. )
上傳時(shí)間: 2014-01-07
上傳用戶:離殤
This program can determin very accurately the nature of the user input
標(biāo)簽: accurately the determin program
上傳時(shí)間: 2015-01-28
上傳用戶:shinesyh
CRLF Output Stream
上傳時(shí)間: 2014-07-16
上傳用戶:13517191407
Write 3270 Session Screen Output to A File
標(biāo)簽: Session Screen Output Write
上傳時(shí)間: 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.
標(biāo)簽: implementing directory algorithm contains
上傳時(shí)間: 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.
標(biāo)簽: VideoTransmit programmed wrapper simple
上傳時(shí)間: 2014-01-06
上傳用戶:zhuyibin
蟲蟲下載站版權(quán)所有 京ICP備2021023401號(hào)-1