TypeError: 'id' argument required in Attempting to add NEO M9N to raspbery pi pico

TypeError: 'id' argument required in Attempting to add NEO M9N to raspbery pi pico

这是我的科学怪人代码,当我在第 12 行定义 gps_module 时出现错误。我将 pico 引脚 4 连接到 GPS 上的 SDA,引脚 5 连接到 SCL,地面,和功率

from machine import Pin, UART, I2C
#Import utime library to implement delay
import utime, time



sda_pin = machine.Pin(4)
scl_pin = machine.Pin(5)

# Create an I2C object out of our SDA and SCL pin objects
gps_module = machine.I2C(sda=sda_pin, scl=scl_pin)




print(gps_module)

#Used to Store NMEA Sentences
buff = bytearray(255)

TIMEOUT = False

#store the status of satellite is fixed or not
FIX_STATUS = False

在声明中尝试 1 或 0

gps_module = machine.I2C(1, sda=sda_pin, scl=scl_pin)

https://docs.micropython.org/en/latest/library/machine.I2C.html#constructors

class machine.I2C(id, *, scl, sda, freq=400000)

使用以下参数构建并return一个新的 I2C 对象:

  • id 标识特定的 I2C 外设。 depend 的允许值 具体来说 port/board
  • scl 应该是一个引脚对象,指定用于 SCL 的引脚。
  • sda 应该是一个引脚对象,指定用于 SDA 的引脚。
  • freq 应该是一个整数,用于设置 SCL 的最大频率。