Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(37)  |  Call(37)  |  Derive(0)  |  Import(0)
Set up the GPIO channel, direction and (optional) pull/up down control
channel        - Either: RPi board pin number (not BCM GPIO 00..nn number).  Pins start from 1
                 or    : BCM GPIO number
direction      - INPUT or OUTPUT
[pull_up_down] - PUD_OFF (default), PUD_UP or PUD_DOWN
[initial]      - Initial value for an output channel

src/a/d/Adafruit_BBIO-0.0.19/test/test_gpio_output.py   Adafruit_BBIO(Download)
    def test_output_high(self):
        GPIO.setup("P8_10", GPIO.OUT)
        GPIO.output("P8_10", GPIO.HIGH)
        value = open('/sys/class/gpio/gpio68/value').read()
        assert int(value)
        GPIO.cleanup()
 
    def test_output_low(self):
        GPIO.setup("P8_10", GPIO.OUT)
    def test_direction_readback(self):
        GPIO.setup("P8_10", GPIO.OUT)
        direction = GPIO.gpio_function("P8_10")
        assert direction == GPIO.OUT
    def test_output_greater_than_one(self):
        GPIO.setup("P8_10", GPIO.OUT)
    def test_output_setup_as_input(self):
        GPIO.setup("P8_10", GPIO.IN)
        with pytest.raises(RuntimeError):
            GPIO.output("P8_10", GPIO.LOW)
            GPIO.cleanup()

src/a/d/Adafruit_BBIO-0.0.19/test/test_gpio_input.py   Adafruit_BBIO(Download)
    def test_input(self):
        GPIO.setup("P8_10", GPIO.IN)
        #returned as an int type
        input_value = GPIO.input("P8_10")
        #value read from the file will have a \n new line
    def test_direction_readback(self):
        GPIO.setup("P8_10", GPIO.IN)
        direction = GPIO.gpio_function("P8_10")
        assert direction == GPIO.IN
 

Previous  1 | 2