.. currentmodule:: omc048 .. _omc048.power_supply: class Power Supply ================== Control the power supply ports by enabling and disabling. .. attention:: Attention, the supply voltage of **port number 4** on all OMC-048 loggers with **BL: 1.03B0** and upwards will be 5V! All other OMC-048 still have four 12V supply ports. Constructor ----------- .. class:: omc048.power_supply(id: integer) Create a power supply object associated with a power supply. - ``id`` is the power supply number 1 to 4, corresponding to pin 7 to 10. Methods ------- .. method:: power_supply.set(state: integer) Set the power supply on or off. - ``state`` is 1 or 0, corresponding to on and off. .. method:: power_supply.on() Enable the power supply to the port. .. method:: power_supply.off() Disable the power supply to the port. .. method:: power_supply.toggle() Switch the power supply state from the current to the other state. Turning it on when it was off and off when it was on. Example ------- The following example enables power supply 1 to 4, turns supply 2 off after 5 seconds and the others after 10. :: import omc048 import time s1 = omc048.power_supply(1) s2 = omc048.power_supply(2) s3 = omc048.power_supply(3) s4 = omc048.power_supply(4) s1.on() s2.on() s3.on() s4.on() time.sleep(5) s2.off() time.sleep(5) s1.off() s3.off() s4.off()