======pin_configure======
WMPRO FW >= 1.0 WMMEGA FW >= 2.0
Configure an I/O pin as a digital input, output, or analog input
====Description====
pin_configure (
int
$pin_index,
int
$pin_type
[,
int
$counter_type
] )
This function will change settings for certain pins on [[hardware:wattmons:WattmonPRO]] and [[hardware:wattmons:WattmonMEGA|MEGA]]. This is actually not to be used unless you know what you are doing, because it may cause certain parts of the device to not function properly.
====Parameters====
$pin_index: The internal pin number. These are the configurable pins:
^Pin Index^External Label (Physical)^Default^Settable as^Description^
|0 |VIN/A1 (PIN 2) |ANALOG|ANALOG/INPUT/OUTPUT|Voltage of primary input |
|1 |A2 (PIN 3) |ANALOG|ANALOG/INPUT/OUTPUT|Voltage of A2 input |
|2 |A3 (PIN 4 ) |ANALOG|ANALOG/INPUT/OUTPUT|Voltage of A3 input |
|3 |Internally available|ANALOG|ANALOG/INPUT/OUTPUT|No physical connection |
|6 |DI1 (PIN 16) |INPUT |INPUT/COUNTER |Digital input (opto-isolated) or counter |
|7 |DI2 (PIN 17) |INPUT |INPUT/COUNTER |Digital input (opto-isolated) or counter |
|8 |DI3 (PIN 18) |INPUT |INPUT/COUNTER |Digital input (opto-isolated) or counter |
|9 |DI4 (PIN 19) |INPUT |INPUT/COUNTER |Digital input (opto-isolated) or counter |
|10|DO1 (PIN 21) |OUTPUT|INPUT/OUTPUT |Digital output |
|11|DO2 (PIN 22) |OUTPUT|INPUT/OUTPUT |Digital output |
|12|DO3 (PIN 23) |OUTPUT|INPUT/OUTPUT |Digital output |
|13|DO4 (PIN 24) |OUTPUT|INPUT/OUTPUT |Digital output |
|14|RL1 (PIN 13) |OUTPUT|INPUT/OUTPUT |Latches the relay on (should never be kept on for long, just pulse to switch) |
|15|RL2 (PIN 14) |OUTPUT|INPUT/OUTPUT |Latches the relay off (should never be kept on for long, just pulse to switch)|
$pin_type: Any of the following (if settable for that pin), allowed values:
^Pin Type^Description^
|1 |Digital Output|
|2 |Digital Input|
|4 |Analog Input|
|16|Counter|
$counter_type: Optional if configuring a COUNTER (pin index 6-9), choose from the following:
^Counter Type^Description^
|0|Trigger on High |
|1|Trigger on Low |
|2|Trigger on any change|
====Return Values====
None
====See Also====
[[pin_get()]] - Return the value of an I/O pin
[[pin_set()]] - Set a digital output to value 1 or 0
[[adc_read()]] - Read an onboard ADC channel