====== IanalogWriteInit() ====== ''IanalogWriteInit()'' sets the maximum, minimum and mode of the MPAINO analog output. {{:en-us_commands:reference:ianalogwriteinit.svg?900|IanalogWriteInit command operation flow}} ''void IanalogWriteInit(uint8_t ch, uint32_t maxValue = 65535UL, uint32_t minValue = 0, bool mode = false)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''IanalogWriteInit(ch, maxValue, minValue, mode)'' | ''uint8_t ch''\\ ''uint32_t maxValue = 65535UL''\\ ''uint32_t minValue = 0''\\ ''bool mode = false'' | ''void'' | Sets the maximum, minimum and mode of the MPAINO analog output. | ===== 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. void setup() { IanalogWriteInit(0, 1000, 0, false); // Set Y module CH0 to a 0–1000 range. } void loop() { IanalogWrite(0, 0, 1000, 500); // Output the midpoint of the configured range. delay(500); } ===== Precautions ===== * Match the module DIP switches, external power supply and output range. * Do not configure these together with PWM functions sharing the same timer. * Do not output values to uninitialized channels. * Currently, MPAINO Y analog output supports channels up to ''0~11''; do not use ''12~15''. * ''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()''. ===== 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:ianalogwrite|IanalogWrite() View detailed description]] * [[:en-us_commands:reference:ianalogwritef|IanalogWritef() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]