User Tools

Site Tools


en-us_commands:reference:ianalogwrite

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:ianalogwrite [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:ianalogwrite [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
 +const uint8_t DEMAND_INPUT = A0;
 +const uint8_t OUTPUT_CHANNEL = 0;
 +
 void setup() { void setup() {
 +  Serial.begin(115200);
 } }
  
 void loop() { void loop() {
-  IanalogWrite(0, 0, 100, 50);  // 50% output +  const int32_t demandPercent = IanalogRead(DEMAND_INPUT, 0, 100);  // Map the analog input value to the specified integer range. 
-  delay(500);+  IanalogWrite(OUTPUT_CHANNEL, 0, 100, demandPercent);  // Map the user's integer value to the analog output range and output it. 
 + 
 +  Serial.print(F("demand=")); 
 +  Serial.print(demandPercent); 
 +  Serial.println(F("%")); 
 +  delay(250);
 } }
 </code> </code>
Line 35: Line 44:
   * Match the output module DIP switches, external supply and wiring to the connected equipment's input specifications.   * Match the output module DIP switches, external supply and wiring to the connected equipment's input specifications.
   * Do not use these together with PWM, pulse output or counter commands using the same timer.   * Do not use these together with PWM, pulse output or counter commands using the same timer.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:analogwriteinit|analogWriteInit() View detailed description]]
 +  * [[:en-us_commands:reference:analogwritefreq|analogWriteFreq() View detailed description]]
 +  * [[:en-us_commands:reference:analogwritemax|analogWriteMax() View detailed description]]
 +  * [[:en-us_commands:reference:ianalogwriteinit|IanalogWriteInit() View detailed description]]
 +  * [[:en-us_commands:reference:ianalogwritef|IanalogWritef() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/ianalogwrite.1788785566.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki