Metadata-Version: 2.1
Name: pimcp3008
Version: 1.0.1
Summary: To use MCP3008 with pigpio.
Home-page: https://github.com/Langur/pimcp3008
Author: Akihisa ONODA
Author-email: akihisa.onoda@osarusystem.com
License: MIT
Description: # Installing
        
        Stable library from PyPi:
        
        * Just run `pip install pimcp3008`
        
        # PiMcp3008's Methods
        
        ## Constructor(config={})
        
        'config' is dictionary type.
        
        ### 'channel'
        
        Configure SPI chip selects of Raspberry Pi.
        
        * Channel.CE0.value
            * CE0 is used for MCP3008
            * Default
        * Channel.CE1.value
            * CE1 is used for MCP3008
        * Channel.CE2.value
            * CE2 is used for MCP3008
            * Only Auxiliary Mode
        
        ### 'clock'
        
        Configure SPI clock of Raspberry Pi.
        
        * Integer value
            * Default: 1000000
        
        ### 'device'
        
        Configure MCP3008 compatible devices.
        
        * Device.MCP3008.value
            * Use MCP3008
            * Default
        * Device.MCP3004.value
            * Use MCP3004
        
        ## read(channels)
        
        Read A/D convert value.
        Argument channels that enumerate integer value is valiable length.
        Return value has include selected channel's value.
        
        * MCP3008: 0 to 7
        * MCP3004: 0 to 3
        
        If argument channels is not exist, return value has include all channel's value.
        
        Return value is dictionary type.
        Key is channels value that type is int.
        Value is integer value.
        
        # Sample
        
        Run `sudo pigpiod` before running the sample.
        
        ## Simple
        
        .. code-block:: shell
        
            # -*- coding: utf-8 -*-
            import pimpc3008 as MPC3008
            import time
            
            obj = MPC3008.PiMpc3008()
            
            try:
                while True:
                    values = obj.read()
                    print(values)
                    time.sleep(10)
            except KeyboardInterrupt:
                pass
        
        
        ## Modify config
        
        'clock' is 100kHz.
        
        .. code-block:: shell
        
            # -*- coding: utf-8 -*-
            import pimpc3008 as MPC3008
            import time
            
            config = {
                'clock' : 100000
            }
            
            # pigpioを初期化する
            obj = MPC3008.PiMpc3008(config)
            
            try:
                while True:
                    values = obj.read()
                    print(values)
                    time.sleep(10)
            except KeyboardInterrupt:
                # Ctrl + C で終了する
                pass
        
        
        ## Select Channel
        
        Get 0ch, 2ch and 4ch values.
        
        .. code-block:: shell
        
            # -*- coding: utf-8 -*-
            import pimpc3008 as MPC3008
            import time
            
            obj = MPC3008.PiMpc3008()
            
            try:
                while True:
                    values = obj.read(0, 2, 4)
                    print(values)
                    time.sleep(10)
            except KeyboardInterrupt:
                pass
        
        
Keywords: pimcp3008 mcp3004 mcp3008 pigpio adc analog-to-digital spi
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
