User Tools

Site Tools


en-us_commands:reference:ianalogwriteinit

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en-us_commands:reference:ianalogwriteinit [2026/09/08 00:53] – 바깥 편집 127.0.0.1en-us_commands:reference:ianalogwriteinit [2026/10/25 08:41] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
 ===== Example ===== ===== Example =====
 +
 +This example uses MPAINO-8A8R(T) with a Y output module and **Analog Output Module → Y** selected. It sets CH0 to a 0–1000 range and outputs its midpoint.
  
 <code cpp> <code cpp>
 void setup() { void setup() {
-  Serial.begin(115200); +  IanalogWriteInit(0, 1000, 0, false);  // Set Y module CH0 to a 0–1000 range.
-  IanalogWriteInit(0, 1000, 0, false);  // Set the maximum, minimum and mode of MPAINO analog outputs.+
 } }
  
 void loop() { void loop() {
-  const int32_t demand = IanalogRead(0, 0, 1000);  // Map the analog input value to the specified integer range. +  IanalogWrite(0, 0, 1000, 500);  // Output the midpoint of the configured range. 
-  IanalogWrite(0, 0, 1000, demand);  // Map the user's integer value to the analog output range and output it. +  delay(500);
-  analogWrite2(1, constrain(demand, 0, 1000));  // Output a raw value for 4–20mA conversion on the specified channel. +
-  delay(20);+
 } }
 </code> </code>
Line 40: Line 39:
 ===== Built-in Commands in the Same Category ===== ===== Built-in Commands in the Same Category =====
  
-  * [[:en-us_commands:reference:analogwriteinit|analogWriteInit() View detailed description]] +  * [[:en-us_commands:reference:analogwriteinit|analogWriteInit() reference]] 
-  * [[:en-us_commands:reference:analogwritefreq|analogWriteFreq() View detailed description]] +  * [[:en-us_commands:reference:analogwritefreq|analogWriteFreq() reference]] 
-  * [[:en-us_commands:reference:analogwritemax|analogWriteMax() View detailed description]] +  * [[:en-us_commands:reference:analogwritemax|analogWriteMax() reference]] 
-  * [[:en-us_commands:reference:ianalogwrite|IanalogWrite() View detailed description]] +  * [[:en-us_commands:reference:ianalogwrite|IanalogWrite() reference]] 
-  * [[:en-us_commands:reference:ianalogwritef|IanalogWritef() View detailed description]]+  * [[:en-us_commands:reference:ianalogwritef|IanalogWritef() reference]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/ianalogwriteinit.1788796397.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki