toggle_switch.py
1 """ 2 Example: Toggle Switch 3 4 This example shows how to use the P1AM-200 Toggle Switch 5 6 This example uses a discrete output module, but can be adapted to other modules 7 _____ _____ 8 | P || S | 9 | 1 || L | 10 | A || O | 11 | M || T | 12 | - || | 13 | 2 || 0 | 14 | 0 || 1 | 15 | 0 || | 16 ¯¯¯¯¯ ¯¯¯¯¯ 17 Written by FACTS Engineering 18 Copyright (c) 2023 FACTS Engineering, LLC 19 Licensed under the MIT license. 20 """ 21 22 import P1AM 23 from p1am_200_helpers import get_switch 24 25 switch = get_switch() # get the switch digitalio object 26 27 base = P1AM.Base() 28 ch2 = base[1][2] 29 30 while True: 31 ch2.value = switch.value