超聲波傳感器適用于對大幅的平面進行靜止測距。普通的超聲波傳感器測距范圍大概是 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
Full support for extended regular expressions (those with intersection and complement); Support for some kinds of cycles in grammar; DFA-based operation; Unicode support; C++ only, requires a modern compiler; Lexical analyzers can be configured to get symbols from any input class (built-in support for std::istream, std::wistream and FILE *); Designed to work with Whale, but can work standalone or interface to other parsers.
標簽: intersection expressions complement for
上傳時間: 2013-12-11
上傳用戶:zhanditian
(其中已經包含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
上傳用戶:離殤
The book presents the entire Java programming language and essential parts of the class libraries: the collection classes and the input-output classes.
標簽: programming essential libraries the
上傳時間: 2015-03-02
上傳用戶:yulg
pdnMesh is an automatic mesh generator and solver for Finite Element problems. It will also do post-processing to generate contour plots and Postscript printouts. GUI support using GTK or MFC (Win32) is available. The problem definition can be done in any form and given to pdnMesh as an input data file. Drawing Exchange Format (DXF) files can be directly imported to pdnmesh. The quality and the coarseness of the mesh can be controlled by giving input parameters.
標簽: automatic generator problems pdnMesh
上傳時間: 2013-12-19
上傳用戶:cuibaigao
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
程序存儲問題:設有n 個程序{1,2,…, n }要存放在長度為L的磁帶上。程序i存放在磁帶上的長度是Li ,1≤i≤n 程序存儲問題要求確定這n 個程序在磁帶上的一個存儲方案,使得能夠在磁帶上存儲盡可能多的程序。 編程任務: 對于給定的n個程序存放在磁帶上的長度,編程計算磁帶上最多可以存儲的程序數。 數據輸入:由文件input.txt給出輸入數據。第一行是正整數n,表示文件個數。接下來的1 行中,有n 個正整數,表示程序存放在磁帶上的長度。 結果輸出: input.txt output.txt 6 50 5 2 3 13 8 80 20
上傳時間: 2013-12-20
上傳用戶:dongqiangqiang
求解tsp問題的模擬退火源碼,數據文件請仿照文件中的input.txt自行創建
上傳時間: 2015-03-17
上傳用戶:talenthn
This an adaptive receiver for a direct-sequence spread spectrum (DS-SS) system over an AWGN channel. The adaptive receiver block is modified from the LMS adaptive filter block in DSP Blockset. For DS-SS signal reception, the adaptive filter needs to have multi-rate operation. The input sample rate is equal to chip rate and the output is at symbol rate. Two rates are related by PG, processing gain
標簽: direct-sequence adaptive receiver spectrum
上傳時間: 2014-01-16
上傳用戶:D&L37