VescNET 0.2.0

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

// Install VescNET as a Cake Tool
#tool nuget:?package=VescNET&version=0.2.0                

VescNET

This library can be used to communicate .NET applications to VESC drivers using usb/serial port.

This project is based on vedderb/bldc_uart_comm_stm32f4_discovery repository.

Table of contents

Features

  • Read VESC firmware information
  • Get values from VESC
  • Read/Set VESC motor parameters
  • Read/Set VESC app parameters
  • Set Duty Cycle
  • Set Current
  • Set Current Brake
  • Set RPM
  • Set Position
  • Set Handbrake Current
  • Set Servo Position
  • Request Encoder Detection
  • Terminal Commands

Usage

Build bldc instance

var buffer = new VescNET.Infra.Buffer();
var packetProcess = new PacketProcess();
var packet = new Packet(buffer, packetProcess);
var serial = new SerialPort();
var comm = new BldcSerial(packet, serial);
var bldc = new Bldc(buffer, comm);

Register communication events

comm.ConnectionChanged += BldcComm_ConnectionChanged;
comm.OnData += BldcComm_OnData;

Handle connection changed event

private void BldcComm_ConnectionChanged(object sender, bool connected)
{
  if (connected)
  {
    Console.log("VESC connected");
  }
  else
  {
    Console.log("VESC disconnected");
  }
}

Handle data event:

private void BldcComm_OnData(object sender, VescNET.Domain.DTOs.ReceivedData e)
{
  switch (e.PacketId)
  {
    case CommPacketId.FwVersion:
    case CommPacketId.GetValues:
    case CommPacketId.DetectEncoder:
      Console.log(PacketProcess.PrintData(e));
      break;
    case CommPacketId.GetMcConf:
    {
      Console.log("McConf received");
      var mcConf = e.Data as McConfiguration;
      // handle mcConf
      break;
    }
    case CommPacketId.GetAppConf:
    {
      Console.log("AppConf received");
      var appConf = e.Data as AppConfiguration;
      // handle appConf
      break;
    }
    case CommPacketId.SetMcConf:
      Console.log("Mcconf sended to VESC");
      bldc.GetMcconf();
      break;
    case CommPacketId.SetAppConf:
      Console.log("Appconf sended to VESC");
      bldc.GetAppconf();
      break;
  }
}
Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
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
0.2.0 189 11/22/2023
0.1.1 123 11/15/2023
0.1.0.1 125 9/16/2023
0.1.0 131 9/16/2023