欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
arduino PID庫文件下載
[打印本頁]
作者:
xiaoyan6hao
時(shí)間:
2019-1-10 17:26
標(biāo)題:
arduino PID庫文件下載
arduinoPID庫文件
0.png
(6.29 KB, 下載次數(shù): 106)
下載附件
2019-1-10 17:33 上傳
3個(gè)文件下載(僅供參考,有錯(cuò)誤請(qǐng)指出):
PID_v1.rar
(6.84 KB, 下載次數(shù): 146)
2019-1-10 17:25 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
/********************************************************
* PID RelayOutput Example
* Same as basic example, except that this time, the output
* is going to a digital pin which (we presume) is controlling
* a relay. the pid is designed to Output an analog value,
* but the relay can only be On/Off.
*
* to connect them together we use "time proportioning
* control" it's essentially a really slow version of PWM.
* first we decide on a window size (5000mS say.) we then
* set the pid to adjust its output between 0 and that window
* size. lastly, we add some logic that translates the PID
* output into "Relay On Time" with the remainder of the
* window being "Relay Off Time"
PID繼電器輸出范例
與基本范例相同,這一次輸出是一個(gè)數(shù)字引腳控制的繼電器。PID被設(shè)計(jì)成
輸出一個(gè)模擬值,但是繼電器只有開關(guān)狀態(tài)。
為了聯(lián)系上兩者,我們使用時(shí)間比例控制,它本質(zhì)上是一個(gè)很慢的PWM。
首先我們決定一個(gè)窗口時(shí)間(比如5000ms)。
然后設(shè)置PID適應(yīng)它的輸出在0到窗口時(shí)間的范圍。
最后我們添加一些邏輯,把PID輸出轉(zhuǎn)換成“繼電器接通時(shí)間”和剩余的
“繼電器斷開時(shí)間”
********************************************************/
#include <PID_v1.h>
#define RelayPin 8
// 定義我們將要使用的變量
//Define Variables we'll be connecting to
double Setpoint, Input, Output;
//指定鏈接和最初的調(diào)優(yōu)參數(shù)
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);
int WindowSize = 2000;
unsigned long windowStartTime;
void setup()
{
windowStartTime = millis();
//初始化變量
//initialize the variables we're linked to
Setpoint = 100;
//告訴PID在從0到窗口大小的范圍內(nèi)取值
//tell the PID to range between 0 and the full window size
myPID.SetOutputLimits(0, WindowSize);
//開啟PID
//turn the PID on
myPID.SetMode(AUTOMATIC);
}
void loop()
{
Input = analogRead(0);
myPID.Compute();
/************************************************
* turn the output pin on/off based on pid output 基于PID輸出,打開或關(guān)閉端口輸出
************************************************/
if(millis() - windowStartTime>WindowSize)
{ //time to shift the Relay Window 繼電器窗口時(shí)間
windowStartTime += WindowSize;
}
if(Output < millis() - windowStartTime) digitalWrite(RelayPin,HIGH);
else digitalWrite(RelayPin,LOW);
}
復(fù)制代碼
作者:
ecpc
時(shí)間:
2019-1-12 12:52
沒有解壓密碼
作者:
muelfox
時(shí)間:
2019-1-14 19:17
謝謝分享
作者:
HeiZu
時(shí)間:
2019-5-4 01:27
感謝分享
作者:
kb_001
時(shí)間:
2019-7-14 21:24
感謝分享
作者:
Markus0010
時(shí)間:
2019-11-1 17:26
謝謝分享
作者:
雷一刀
時(shí)間:
2020-2-5 22:58
感謝分享
作者:
way42
時(shí)間:
2024-1-17 16:08
樓主,請(qǐng)問為什么PID定義那里編譯不過呢?會(huì)是什么原因?
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1