Usn.Pb1151.DeviceKit 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Usn.Pb1151.DeviceKit --version 1.1.0
                    
NuGet\Install-Package Usn.Pb1151.DeviceKit -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Usn.Pb1151.DeviceKit" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Usn.Pb1151.DeviceKit" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Usn.Pb1151.DeviceKit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Usn.Pb1151.DeviceKit --version 1.1.0
                    
#r "nuget: Usn.Pb1151.DeviceKit, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Usn.Pb1151.DeviceKit@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Usn.Pb1151.DeviceKit&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Usn.Pb1151.DeviceKit&version=1.1.0
                    
Install as a Cake Tool

Usn.Pb1151.DeviceKit

A small C# I/O library for the PB1151 – Objektorientert programmering og databaser course at USN.

It talks to a microcontroller board (4 LEDs, 1 servo, 3 pushbuttons, a TMP102 temperature sensor, and an ADXL345 accelerometer) over a line-based JSON protocol, connected either via a USB serial port or Bluetooth Low Energy (Nordic UART Service). You use it as an object-oriented API — setting properties and subscribing to events — without touching JSON or the raw port yourself.

Install

dotnet add package Usn.Pb1151.DeviceKit

Requires .NET 10 on Windows (the BLE transport uses the Windows Runtime Bluetooth APIs).

Quick start

using Usn.Pb1151.DeviceKit;

// Connect over USB serial...
var port = new SerialPortEx { PortName = "COM3", BaudRate = 9600 };
port.Open();
var controller = new JsonSerialController(port);

// ...or over BLE instead — same controller API either way.
// var ble = new BleNusEx("Pico-NUS");
// await ble.ConnectAsync(TimeSpan.FromSeconds(15));
// var controller = new JsonSerialController(ble);

// Turn LED1 on
controller.LedControl["LED1"].Value = 1;

// Move servo SV1 to 90 degrees
controller.ServoControl["SV1"].Angle = 90;

// React to a pushbutton
controller.ButtonControl["SW1"].ValueChanged += (s, e) =>
    Console.WriteLine($"{e.Id} = {e.Value}");

// Read the temperature sensor once
controller.SensorControl["TEMP1"].DataChanged += (s, e) =>
{
    var temp = (TempSensor)e.Sensor;
    Console.WriteLine($"{temp.Value} {temp.Unit}");
};
controller.SensorControl.Read("TEMP1");

What's in the box

Type Purpose
JsonSerialController Entry point. Owns LedControl, ServoControl, ButtonControl, SensorControl over one shared port.
SerialPortEx ISerialDataReadWrite over a USB SerialPort.
BleNusEx ISerialDataReadWrite over BLE (Nordic UART Service). Drop-in replacement for SerialPortEx.
ISerialDataReadWrite The transport abstraction — implement it yourself to plug in a different transport or a test double.

Full API reference, JSON wire protocol, and sequence diagrams: see JsonSerialController.md.

Example project

A complete Windows Forms demo that consumes this library lives in the parent repository (SerialLedBtnLibEx) — see its README.md for a walkthrough of wiring the controller up to a GUI.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible.  net10.0-windows10.0.17763 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 119 8/6/2026
1.1.1 109 8/6/2026
1.1.0 98 8/5/2026
1.0.1 99 8/5/2026
1.0.0 111 8/5/2026

1.1.0: Multi-targeted the package for net10.0-windows and net10.0-windows10.0.17763.0, so it now restores in projects created from the standard WinForms/WPF templates (which target plain net10.0-windows) without editing the consuming project's TargetFramework. On net10.0-windows, everything is available except BleNusEx (BLE requires the WinRT projections only available on the versioned windows10.0.17763.0 TFM); bump the consuming project's TargetFramework to net10.0-windows10.0.17763.0 to use BLE. 1.0.1: Lowered the minimum target Windows version from 10.0.19041.0 to 10.0.17763.0 (Windows 10, version 1809) to relax consuming-project TargetFramework requirements; no API changes. 1.0.0: Initial release. JsonSerialController with LedControl, ServoControl, ButtonControl, and SensorControl (TMP102 temperature, ADXL345 acceleration). Two transports: SerialPortEx (USB serial) and BleNusEx (BLE Nordic UART Service), both behind ISerialDataReadWrite.