Example 2: Disable Channels

examples/ex2_disable_channels.py
 1#-----------------------------------------------------------------------
 2# Qwiic Mux - Example 2
 3#-----------------------------------------------------------------------
 4#
 5# Written by  SparkFun Electronics, June 2019
 6# Author: Wes Furuya
 7#
 8# Compatibility: https://www.sparkfun.com/products/14685
 9# 
10# Do you like this library? Help support SparkFun. Buy a board!
11# For more information on Qwiic Mux, check out the product page
12# linked above.
13#
14# This program is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program.  If not, see <http:www.gnu.org/licenses/>.
21#
22#=======================================================================
23# Copyright (c) 2019 SparkFun Electronics
24#
25# Permission is hereby granted, free of charge, to any person obtaining
26# a copy of this software and associated documentation files (the
27# "Software"), to deal in the Software without restriction, including
28# without limitation the rights to use, copy, modify, merge, publish,
29# distribute, sublicense, and/or sell copies of the Software, and to
30# permit persons to whom the Software is furnished to do so, subject to
31# the following conditions:
32#
33# The above copyright notice and this permission notice shall be
34# included in all copies or substantial portions of the Software.
35#
36# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
39# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
40# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43#=======================================================================
44
45"""
46This example disables channels 0 and 4.
47"""
48
49import qwiic
50import time
51
52# Initialize Constructor
53test = qwiic.QwiicTCA9548A()
54
55# Test Run
56#########################################
57# List Channel Configuration
58test.list_channels()
59
60# Enable Channels 0 and 4
61test.disable_channels([0,4])
62
63# List Channel Configuration
64test.list_channels()