91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-10
  • 語言: 其他
  • 標簽:

資源簡介

解壓到arduino-1.6.5-windows\arduino-1.6.5\libraries里面

資源截圖

代碼片段和文件信息

/**********************************************************************************************
?*?Arduino?PID?Library?-?Version?1.1.1
?*?by?Brett?Beauregard??brettbeauregard.com
?*
?*?This?Library?is?licensed?under?a?GPLv3?License
?**********************************************************************************************/

#if?ARDUINO?>=?100
??#include?“Arduino.h“
#else
??#include?“WProgram.h“
#endif

#include?

/*Constructor?(...)*********************************************************
?*????The?parameters?specified?here?are?those?for?for?which?we?can‘t?set?up?
?*????reliable?defaults?so?we?need?to?have?the?user?set?them.
?***************************************************************************/
PID::PID(double*?Input?double*?Output?double*?Setpoint
????????double?Kp?double?Ki?double?Kd?int?ControllerDirection)
{

????myOutput?=?Output;
????myInput?=?Input;
????mySetpoint?=?Setpoint;
inAuto?=?false;

PID::SetOutputLimits(0?255); //default?output?limit?corresponds?to?
//the?arduino?pwm?limits

????SampleTime?=?100; //default?Controller?Sample?Time?is?0.1?seconds

????PID::SetControllerDirection(ControllerDirection);
????PID::SetTunings(Kp?Ki?Kd);

????lastTime?=?millis()-SampleTime;
}
?
?
/*?Compute()?**********************************************************************
?*?????This?as?they?say?is?where?the?magic?happens.??this?function?should?be?called
?*???every?time?“void?loop()“?executes.??the?function?will?decide?for?itself?whether?a?new
?*???pid?Output?needs?to?be?computed.??returns?true?when?the?output?is?computed
?*???false?when?nothing?has?been?done.
?**********************************************************************************/?
bool?PID::Compute()
{
???if(!inAuto)?return?false;
???unsigned?long?now?=?millis();
???unsigned?long?timeChange?=?(now?-?lastTime);
???if(timeChange>=SampleTime)
???{
??????/*Compute?all?the?working?error?variables*/
??double?input?=?*myInput;
??????double?error?=?*mySetpoint?-?input;
??????ITerm+=?(ki?*?error);
??????if(ITerm?>?outMax)?ITerm=?outMax;
??????else?if(ITerm???????double?dInput?=?(input?-?lastInput);
?
??????/*Compute?PID?Output*/
??????double?output?=?kp?*?error?+?ITerm-?kd?*?dInput;
??????
??if(output?>?outMax)?output?=?outMax;
??????else?if(output? ??*myOutput?=?output;
??
??????/*Remember?some?variables?for?next?time*/
??????lastInput?=?input;
??????lastTime?=?now;
??return?true;
???}
???else?return?false;
}


/*?SetTunings(...)*************************************************************
?*?This?function?allows?the?controller‘s?dynamic?performance?to?be?adjusted.?
?*?it‘s?called?automatically?from?the?constructor?but?tunings?can?also
?*?be?adjusted?on?the?fly?during?normal?operation
?******************************************************************************/?
void?PID::SetTunings(double?Kp?double?Ki?double?Kd)
{
???if?(Kp<0?||?Ki<0?||?Kd<0)?return;
?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-05-10?18:38??Arduino-PID-Library-master\
?????文件????????6918??2015-05-10?18:38??Arduino-PID-Library-master\PID_v1.cpp
?????文件????????3454??2015-05-10?18:38??Arduino-PID-Library-master\PID_v1.h
?????文件?????????532??2015-05-10?18:38??Arduino-PID-Library-master\README.txt
?????目錄???????????0??2015-05-10?18:38??Arduino-PID-Library-master\examples\
?????目錄???????????0??2015-05-10?18:38??Arduino-PID-Library-master\examples\PID_AdaptiveTunings\
?????文件????????1535??2015-05-10?18:38??Arduino-PID-Library-master\examples\PID_AdaptiveTunings\PID_AdaptiveTunings.ino
?????目錄???????????0??2015-05-10?18:38??Arduino-PID-Library-master\examples\PID_Basic\
?????文件?????????737??2015-05-10?18:38??Arduino-PID-Library-master\examples\PID_Basic\PID_Basic.ino
?????目錄???????????0??2015-05-10?18:38??Arduino-PID-Library-master\examples\PID_RelayOutput\
?????文件????????1809??2015-05-10?18:38??Arduino-PID-Library-master\examples\PID_RelayOutput\PID_RelayOutput.ino
?????文件?????????743??2015-05-10?18:38??Arduino-PID-Library-master\keywords.txt
?????文件?????????549??2015-05-10?18:38??Arduino-PID-Library-master\library.json
?????文件?????????392??2015-05-10?18:38??Arduino-PID-Library-master\library.properties

評論

共有 條評論

相關資源