亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

蟲蟲首頁| 資源下載| 資源專輯| 精品軟件
登錄| 注冊

low-frequency

  • Arduino應(yīng)用_Arduino連接超聲波傳感器測距

    超聲波傳感器適用于對大幅的平面進(jìn)行靜止測距。普通的超聲波傳感器測距范圍大概是 2cm~450cm,分辨率3mm(淘寶賣家說的,筆者測試環(huán)境沒那么好,個人實測比較穩(wěn)定的 距離10cm~2m 左右,超過此距離就經(jīng)常有偶然不準(zhǔn)確的情況發(fā)生了,當(dāng)然不排除筆者技術(shù) 問題。) 測試對象是淘寶上面最便宜的SRF-04 超聲波傳感器,有四個腳:5v 電源腳(Vcc),觸發(fā)控制端(Trig),接收端(Echo),地端(GND) 附:SRF 系列超聲波傳感器參數(shù)比較   模塊工作原理: 采用IO 觸發(fā)測距,給至少10us 的高電平信號; 模塊自動發(fā)送8個40KHz 的方波,自動檢測是否有信號返回; 有信號返回,通過IO 輸出一高電平,高電平持續(xù)的時間就是超聲波從發(fā)射到返回的時間.測試距離=(高電平時間*聲速(340m/s))/2; 電路連接方法   Arduino 程序例子: constintTrigPin = 2; constintEchoPin = 3; floatcm; voidsetup() { Serial.begin(9600); pinMode(TrigPin, OUTPUT); pinMode(EchoPin, INPUT); } voidloop() { digitalWrite(TrigPin, LOW); //低高低電平發(fā)一個短時間脈沖去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; //保留兩位小數(shù) Serial.print(cm); Serial.print("cm"); Serial.println(); delay(1000); }

    標(biāo)簽: Arduino 連接 超聲波傳感器

    上傳時間: 2013-11-01

    上傳用戶:xiaoyuer

  • Arduino學(xué)習(xí)筆記4_Arduino軟件模擬PWM

    注:1.這篇文章斷斷續(xù)續(xù)寫了很久,畫圖技術(shù)也不精,難免錯漏,大家湊合看.有問題可以留言.      2.論壇排版把我的代碼縮進(jìn)全弄沒了,大家將代碼粘貼到arduino編譯器,然后按ctrl+T重新格式化代碼格式即可看的舒服. 一、什么是PWM PWM 即Pulse Wavelength Modulation 脈寬調(diào)制波,通過調(diào)整輸出信號占空比,從而達(dá)到改 變輸出平均電壓的目的。相信Arduino 的PWM 大家都不陌生,在Arduino Duemilanove 2009 中,有6 個8 位精度PWM 引腳,分別是3, 5, 6, 9, 10, 11 腳。我們可以使用analogWrite()控 制PWM 腳輸出頻率大概在500Hz 的左右的PWM 調(diào)制波。分辨率8 位即2 的8 次方等于 256 級精度。但是有時候我們會覺得6 個PWM 引腳不夠用。比如我們做一個10 路燈調(diào)光, 就需要有10 個PWM 腳。Arduino Duemilanove 2009 有13 個數(shù)字輸出腳,如果它們都可以 PWM 的話,就能滿足條件了。于是本文介紹用軟件模擬PWM。 二、Arduino 軟件模擬PWM Arduino PWM 調(diào)壓原理:PWM 有好幾種方法。而Arduino 因為電源和實現(xiàn)難度限制,一般 使用周期恒定,占空比變化的單極性PWM。 通過調(diào)整一個周期里面輸出腳高/低電平的時間比(即是占空比)去獲得給一個用電器不同 的平均功率。 如圖所示,假設(shè)PWM 波形周期1ms(即1kHz),分辨率1000 級。那么需要一個信號時間 精度1ms/1000=1us 的信號源,即1MHz。所以說,PWM 的實現(xiàn)難點(diǎn)在于需要使用很高頻的 信號源,才能獲得快速與高精度。下面先由一個簡單的PWM 程序開始: const int PWMPin = 13; int bright = 0; void setup() { pinMode(PWMPin, OUTPUT); } void loop() { if((bright++) == 255) bright = 0; for(int i = 0; i < 255; i++) { if(i < bright) { digitalWrite(PWMPin, HIGH); delayMicroseconds(30); } else { digitalWrite(PWMPin, LOW); delayMicroseconds(30); } } } 這是一個軟件PWM 控制Arduino D13 引腳的例子。只需要一塊Arduino 即可測試此代碼。 程序解析:由for 循環(huán)可以看出,完成一個PWM 周期,共循環(huán)255 次。 假設(shè)bright=100 時候,在第0~100 次循環(huán)中,i 等于1 到99 均小于bright,于是輸出PWMPin 高電平; 然后第100 到255 次循環(huán)里面,i 等于100~255 大于bright,于是輸出PWMPin 低電平。無 論輸出高低電平都保持30us。 那么說,如果bright=100 的話,就有100 次循環(huán)是高電平,155 次循環(huán)是低電平。 如果忽略指令執(zhí)行時間的話,這次的PWM 波形占空比為100/255,如果調(diào)整bright 的值, 就能改變接在D13 的LED 的亮度。 這里設(shè)置了每次for 循環(huán)之后,將bright 加一,并且當(dāng)bright 加到255 時歸0。所以,我們 看到的最終效果就是LED 慢慢變亮,到頂之后然后突然暗回去重新變亮。 這是最基本的PWM 方法,也應(yīng)該是大家想的比較多的想法。 然后介紹一個簡單一點(diǎn)的。思維風(fēng)格完全不同。不過對于驅(qū)動一個LED 來說,效果與上面 的程序一樣。 const int PWMPin = 13; int bright = 0; void setup() { pinMode(PWMPin, OUTPUT); } void loop() { digitalWrite(PWMPin, HIGH); delayMicroseconds(bright*30); digitalWrite(PWMPin, LOW); delayMicroseconds((255 - bright)*30); if((bright++) == 255) bright = 0; } 可以看出,這段代碼少了一個For 循環(huán)。它先輸出一個高電平,然后維持(bright*30)us。然 后輸出一個低電平,維持時間((255-bright)*30)us。這樣兩次高低就能完成一個PWM 周期。 分辨率也是255。 三、多引腳PWM Arduino 本身已有PWM 引腳并且運(yùn)行起來不占CPU 時間,所以軟件模擬一個引腳的PWM 完全沒有實用意義。我們軟件模擬的價值在于:他能將任意的數(shù)字IO 口變成PWM 引腳。 當(dāng)一片Arduino 要同時控制多個PWM,并且沒有其他重任務(wù)的時候,就要用軟件PWM 了。 多引腳PWM 有一種下面的方式: int brights[14] = {0}; //定義14個引腳的初始亮度,可以隨意設(shè)置 int StartPWMPin = 0, EndPWMPin = 13; //設(shè)置D0~D13為PWM 引腳 int PWMResolution = 255; //設(shè)置PWM 占空比分辨率 void setup() { //定義所有IO 端輸出 for(int i = StartPWMPin; i <= EndPWMPin; i++) { pinMode(i, OUTPUT); //隨便定義個初始亮度,便于觀察 brights[ i ] = random(0, 255); } } void loop() { //這for 循環(huán)是為14盞燈做漸亮的。每次Arduino loop()循環(huán), //brights 自增一次。直到brights=255時候,將brights 置零重新計數(shù)。 for(int i = StartPWMPin; i <= EndPWMPin; i++) { if((brights[i]++) == PWMResolution) brights[i] = 0; } for(int i = 0; i <= PWMResolution; i++) //i 是計數(shù)一個PWM 周期 { for(int j = StartPWMPin; j <= EndPWMPin; j++) //每個PWM 周期均遍歷所有引腳 { if(i < brights[j])\   所以我們要更改PWM 周期的話,我們將精度(代碼里面的變量:PWMResolution)降低就行,比如一般調(diào)整LED 亮度的話,我們用64 級精度就行。這樣速度就是2x32x64=4ms。就不會閃了。

    標(biāo)簽: Arduino PWM 軟件模擬

    上傳時間: 2013-10-23

    上傳用戶:mqien

  • libpcap is a system-independent interface for user-level packet capture. libpcap provides a portable

    libpcap is a system-independent interface for user-level packet capture. libpcap provides a portable framework for low-level network monitoring. Applications include network statistics collection, security monitoring, network debugging, etc.

    標(biāo)簽: libpcap system-independent user-level interface

    上傳時間: 2014-08-11

    上傳用戶:saharawalker

  • 一個簡單的應(yīng)用程序

    一個簡單的應(yīng)用程序,用來說明循環(huán)結(jié)構(gòu)與分支結(jié)構(gòu)的嵌套使用 * 程序功能:猜數(shù)游戲。定義被猜的數(shù)。通過鍵盤輸入進(jìn)行猜數(shù), * 如猜錯則顯示“**Wrong**”, “Too high”或“Too low ”; * 猜對則顯示“**Right**”后退出

    標(biāo)簽: 應(yīng)用程序

    上傳時間: 2014-01-16

    上傳用戶:tuilp1a

  • The flpydisk sample is a floppy driver that resides in the directory \NtddkSrcStorageFdcFlpydsk. It

    The flpydisk sample is a floppy driver that resides in the directory \\Ntddk\Src\Storage\Fdc\Flpydsk. It is similar to a class driver in that it sits a level above the floppy disk controller in the driver stack, and brokers communication between the application level and the low-level driver. The floppy driver takes commands from the application and then calls routines in the controller which will in turn perform the actual interaction with the device. The sample compiles in 64-bit, but has not been tested in this environment. It is compatible with x86 and Alpha platforms.

    標(biāo)簽: NtddkSrcStorageFdcFlpydsk directory flpydisk resides

    上傳時間: 2015-03-30

    上傳用戶:龍飛艇

  • 自制51編程器 I have build my own programmer. This device can program the AT89C51 and works with it. So i

    自制51編程器 I have build my own programmer. This device can program the AT89C51 and works with it. So it can easily be adapted to programming other devices by itself. The Atmel Flash devices are ideal for developing, since they can be reprogrammed easy, often and fast. You need only 1 or 2 devices in low cost plastic case for developing. In contrast you need 10 or more high cost windowed devices if you must develop with EPROM devices (e.g. Phillips 87C751).

    標(biāo)簽: programmer program device build

    上傳時間: 2015-05-11

    上傳用戶:sdq_123

  • ZigBee™ 是專為低速率傳感器和控制網(wǎng)絡(luò)設(shè)計的無線網(wǎng)絡(luò)協(xié)議。有許多應(yīng)用可從ZigBee 協(xié)議受益

    ZigBee™ 是專為低速率傳感器和控制網(wǎng)絡(luò)設(shè)計的無線網(wǎng)絡(luò)協(xié)議。有許多應(yīng)用可從ZigBee 協(xié)議受益,其中可能的一些應(yīng)用有:建筑自動化網(wǎng)絡(luò)、住宅安防系統(tǒng)、工業(yè)控制網(wǎng)絡(luò)、遠(yuǎn)程抄表以及PC 外設(shè)。此程序包提供的是Zigbee協(xié)義棧函數(shù)庫源代碼,它實現(xiàn)了一個與物理層 無關(guān)的應(yīng)用程序接口。 因此,無需做重大修改就可以輕松地在射頻(Radio Frequency,RF)收發(fā)器之間移植應(yīng)用程序。

    標(biāo)簽: ZigBee 8482 協(xié)議 低速

    上傳時間: 2014-01-16

    上傳用戶:Pzj

  • he LPC932 can be used to create a Pulse Width Modulated PWM signal. That s an analog signal, with on

    he LPC932 can be used to create a Pulse Width Modulated PWM signal. That s an analog signal, with only 2 discrete levels, for example 0V and 5V and a constant period. The current value of this signal at a certain poiTnt of time is proportional to its Duty Cycle. That s the High Time during one period divided by the period. It can also be calculated as the average value during a particular period. That means after low pass filtering, (e.g. RC circuit) the signal becomes analog, with an actual value controlled by the microcontroller. The PWM functionality enables the LPC932 to control for example the speed of DC motors or the brightness of electric lighting.

    標(biāo)簽: signal Modulated analog create

    上傳時間: 2015-05-14

    上傳用戶:CHINA526

  • 頻率調(diào)制

    頻率調(diào)制,It is a diffrent matlab code for frequency modulation.

    標(biāo)簽: 頻率 調(diào)制

    上傳時間: 2015-05-30

    上傳用戶:wanqunsheng

  • Routine mampres: To obtain amplitude response from h(exp(jw)). input parameters: h :n dimensione

    Routine mampres: To obtain amplitude response from h(exp(jw)). input parameters: h :n dimensioned complex array. the frequency response is stored in h(0) to h(n-1). n :the dimension of h and amp. fs :sampling frequency (Hz). iamp:If iamp=0: The Amplitude Res. amp(k)=abs(h(k)) If iamp=1: The Amplitude Res. amp(k)=20.*alog10(abs(h(k))). output parameters: amp :n dimensioned real array. the amplitude-frequency response is stored in amp(0) to amp(n-1). Note: this program will generate a data file "filename.dat" . in chapter 2

    標(biāo)簽: dimensione parameters amplitude response

    上傳時間: 2013-12-19

    上傳用戶:xfbs821

主站蜘蛛池模板: 福州市| 万州区| 贺兰县| 北京市| 泽州县| 博乐市| 连州市| 登封市| 永仁县| 清镇市| 兴和县| 大新县| 汕头市| 桐庐县| 崇仁县| 丰县| 辛集市| 商城县| 呼和浩特市| 肇源县| 普格县| 石狮市| 三江| 巴彦淖尔市| 普安县| 通州区| 黄冈市| 昭觉县| 泾源县| 会同县| 鄂州市| 柘城县| 闸北区| 游戏| 湾仔区| 海口市| 双城市| 永安市| 屯昌县| 西安市| 彰化县|