超聲波傳感器適用于對大幅的平面進行靜止測距。普通的超聲波傳感器測距范圍大概是 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