User Tools

Site Tools


en-us_commands:reference:pwm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en-us_commands:reference:pwm [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:pwm [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-PWM(2132768, true);  // Example: when D21 is exposed as PWM on the board+void setup() { 
 +  IpidSet(1, 5.0, 0.5, 1.0, 100, 0, 65535);  // Set PID coefficients, calculation interval and output range. 
 +
 + 
 +void loop() { 
 +  float pv = ntcReadf(4);  // Return the NTC 3950 10kΩ sensor temperature as a floating-point value in °C. 
 +  float sv = 50.0; 
 +  uint16_t output = (uint16_t)IpidRun(1, pv, sv);  // Calculate the PID output from the current value and setpoint. 
 + 
 +  PWM(12output, true);  // Output 8-bit or 16-bit PWM on the specified pin. 
 +}
 </code> </code>
  
Line 24: Line 34:
   * Changing frequency or resolution may also affect other channels on the same timer.   * Changing frequency or resolution may also affect other channels on the same timer.
   * Ensure the connected load is safe when stopping or resetting outputs.   * Ensure the connected load is safe when stopping or resetting outputs.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:fdpwm|FDPWM() View detailed description]]
 +  * [[:en-us_commands:reference:pwmoff|PWMOFF() View detailed description]]
 +  * [[:en-us_commands:reference:pwm_reset|PWM_RESET() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/pwm.1788785569.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki