User Tools

Site Tools


en-us_commands:reference:analogwrite2

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:analogwrite2 [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:analogwrite2 [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-analogWrite2(0, 32767);  // Output approx. 12mA on channel 0+void setup() { 
 +  Serial.begin(115200); 
 +  IanalogWriteInit(0, 1000, 0, false);  // Set the maximum, minimum and mode of MPAINO analog outputs. 
 +
 + 
 +void loop() { 
 +  const int32_t demand = IanalogRead(0, 0, 1000);  // Map the analog input value to the specified integer range. 
 +  IanalogWrite(0, 0, 1000, demand);  // Map the user's integer value to the analog output range and output it. 
 +  analogWrite2(1, constrain(demand, 0, 1000));  // Output a raw value for 4–20mA conversion on the specified channel
 +  delay(20); 
 +}
 </code> </code>
  
Line 27: Line 37:
   * ''analogWriteInit()'', ''analogWriteFreq()'' and ''analogWriteMax()'' are for Y analog output channels and must not be used for high-speed pulse channels ''20~31''.   * ''analogWriteInit()'', ''analogWriteFreq()'' and ''analogWriteMax()'' are for Y analog output channels and must not be used for high-speed pulse channels ''20~31''.
   * Do not use high-speed pulse GPIO numbers ''130~141'' with ''analogWrite()''.   * Do not use high-speed pulse GPIO numbers ''130~141'' with ''analogWrite()''.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:ianalogwrite2|IanalogWrite2() View detailed description]]
 +  * [[:en-us_commands:reference:ianalogwrite2f|IanalogWrite2f() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/analogwrite2.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki