【问题标题】:Is there a specific getting started guide for the M5StickCPlus?M5StickCPlus 是否有特定的入门指南?
【发布时间】:2022-08-03 06:14:55
【问题描述】:

M5StickCPlus 是否有特定的入门指南?我试图从样本仓库中调整一些样本,特别是Blinky

我尝试了几种变体,但我无法访问 LED;我得到一个例外

    ++++ Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (8) ++++
    ++++ Message: 
    ++++ nanoFramework.M5Stack.M5StickCPlus::get_Led [IP: 000e] ++++
    ++++ Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (9) ++++
    ++++ Message: 
    ++++ nanoFramework.M5Stack.M5StickCPlus::get_Led [IP: 000e] ++++
    public class Program
    { 
        public static void Main()
        {
            M5StickCPlus.Led.Write(PinValue.Low);
        }
    }
    public class Program
    { 
        private static GpioController gpio = new GpioController();
        public static void Main()
        {
            gpio.OpenPin(M5StickCPlus.Led.PinNumber);
            M5StickCPlus.Led.Write(PinValue.Low);
        }
    }

    标签: nanoframework


    【解决方案1】:

    只是简单地查看了代码,似乎构造函数中缺少 GpioController 的 init。请在 nanoFramework github home repo 上提出一个问题。

    【讨论】:

      【解决方案2】:

      是的 - 如果您首先获取内部 GPIO 对象,则可以使用 LED 对象。

      Debug.WriteLine($"{M5StickCPlus.GpioController.IsPinOpen(10)}");
      M5StickCPlus.Led.Toggle();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-10
        • 2011-05-06
        • 1970-01-01
        • 2012-07-22
        • 1970-01-01
        • 2010-09-30
        相关资源
        最近更新 更多