Upgrade Nuget
大石头 authored at 2024-09-27 23:48:45
265.00 B
SmartA4
using SmartA4;

var key = new InputPort { FileName = "/dev/key" };

var f = false;
for (var i = 0; i < 100; i++)
{
    var rs = key.Read();
    if (rs != f)
    {
        f = rs;
        Console.WriteLine(f ? "按下" : "松开");
    }

    Thread.Sleep(100);
}