我的代码如下
import sys
from sys import argv,exit
from pygpio import *
IN1 = 1
def setup_gpio():
BaseGPIO.setup(IN1, OUT)
if name == 'main':
app = QApplication(sys.argv)
setup_gpio()
sys.exit(app.exec_())
出现如下报错
File "D:\lpcj\Qt-Camera\lpcj3.py", line 166, in setup_gpio
BaseGPIO.setup(IN1, OUT)
setup() missing positional argument:'mode'
打开pygpio目录下的gpio.py文件,有如下内容
import Adafruit_GPIO.Platform as Platform
OUT = 0
IN = 1
HIGH = True
LOW = False
RISING = 1
FALLING = 2
BOTH = 3
PUD_OFF = 0
PUD_DOWN = 1
PUD_UP = 2
class BaseGPIO(object):
"""Base class for implementing simple digital IO for a platform.
Implementors are expected to subclass from this and provide an implementation
of the setup, output, and input functions."""
def setup(self,pin,mode,pull_up_down=PUD_OFF):
"""Set the input or output mode for a specified pin. Mode should be
either OUT or IN."""
raise NotImplementedError
这个setup()里的第一个参数为什么是self,怎么赋值,我的pin是IN1,mode是OUT,为什么说我缺少mode参数?