ArduinoConnect 1.0.0

dotnet add package ArduinoConnect --version 1.0.0                
NuGet\Install-Package ArduinoConnect -Version 1.0.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="ArduinoConnect" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArduinoConnect --version 1.0.0                
#r "nuget: ArduinoConnect, 1.0.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.
// Install ArduinoConnect as a Cake Addin
#addin nuget:?package=ArduinoConnect&version=1.0.0

// Install ArduinoConnect as a Cake Tool
#tool nuget:?package=ArduinoConnect&version=1.0.0                

Arduino Connect

Windows BLE Conector to your Arduino

The Bluetooth Connect NuGet is an on .Net 6.0 based wrapper around the Windows.Devices.Bluetooth to send and recive data from a BLE device like a arduino. If the arduino supports notification then reciving data will be handeled by an event.

Features

  • Enable and disable Bluetooth.
  • Scan for devices.
  • Disconnect.
  • Send and recive byte arrays

Tech

It is available on GitHub: Repository: https://github.com/Meyn1/ArduinoConnect

How to use

Import the Library. As example how to send a string

     static void Main(string[] args)
        {
            //Scanning
            BLEHandler ble = new();
            Thread.Sleep(2000);
            //Select a Device
            DeviceInformation[] devices = ble.FoundDevices;
            int i = 0;
            Array.ForEach(devices, (device) => { Console.WriteLine(i++ + " |  " + device.Name); });
            Console.WriteLine("Please insert index of device and press enter:");
            int index = int.Parse(Console.ReadLine() ?? "0");
            ble.MessageRecived += (r, args) =>
            {
                DataReader reader = DataReader.FromBuffer(args.CharacteristicValue);
                reader.UnicodeEncoding = UnicodeEncoding.Utf8;
                string receivedString = reader.ReadString(reader.UnconsumedBufferLength);
                Console.WriteLine("Recieved Message: " + receivedString);
            };
            DeviceInformation device = devices[index];
            //Connect to device
            Console.WriteLine("Connecting...");
            bool result = ble.Connect(device).Result;
            if (result)
                Console.WriteLine("Connected");
            else Console.WriteLine("Could not connect!");

            //Send Data input
            string input = Console.ReadLine() ?? "";
            while (true)
            {
                Console.WriteLine(ble.Send(input).Result);
                DataReader dataReader = DataReader.FromBuffer(buffer);
                byte[] bytes = new byte[buffer.Length];
                dataReader.ReadBytes(bytes);
                //Look up which bytes were sended
                Array.ForEach(bytes, x => Console.Write(x + " | "));
                Console.WriteLine();
                input = Console.ReadLine() ?? "";
            }
        }

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0-windows10.0.17763 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0-windows10.0.17763

    • No dependencies.

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.0.0 266 1/3/2023