User Tools

Site Tools


en-us_commands:reference:analogwrite2

This is an old revision of the document!


analogWrite2()

analogWrite2() outputs a raw value for 4~20mA conversion on the specified channel.

analogWrite2 command operation flow

void analogWrite2(uint8_t ch, uint16_t value)

Commands

Command Arguments Return Value Operation
analogWrite2(ch, value) uint8_t ch
uint16_t value
void Outputs a raw value for 4~20mA conversion on the specified channel.

Example

analogWrite2(0, 32767);  // Output approx. 12mA on channel 0

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 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