Back to Index

Definition: ain(idx) — Allowed: numeric expression index; Not allowed: string index.

Reads an analog input channel (1-based index in scripts). Returns an integer provided by the host.

Example

pressure = ain(1);
publish("plc/pressure", pressure);