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
en-us_commands:reference:ianalogwriteinit [2026/09/08 00:53] – 바깥 편집 127.0.0.1en-us_commands:reference:ianalogwriteinit [2026/09/14 20:30] (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>
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