Pamoja.Actuators
0.1.18
dotnet add package Pamoja.Actuators --version 0.1.18
NuGet\Install-Package Pamoja.Actuators -Version 0.1.18
<PackageReference Include="Pamoja.Actuators" Version="0.1.18" />
<PackageVersion Include="Pamoja.Actuators" Version="0.1.18" />
<PackageReference Include="Pamoja.Actuators" />
paket add Pamoja.Actuators --version 0.1.18
#r "nuget: Pamoja.Actuators, 0.1.18"
#:package Pamoja.Actuators@0.1.18
#addin nuget:?package=Pamoja.Actuators&version=0.1.18
#tool nuget:?package=Pamoja.Actuators&version=0.1.18
Pamoja.Actuators
PCA9685 PWM and servo pulses, and stepper coil sequencing. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
dotnet add package Pamoja.Actuators
using Pamoja.Actuators;
This pulls in Pamoja.Native, the compiled engine. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/ActuatorsGuide.cs:
// A servo bank wants 50 Hz. The prescale register that produces it is derived
// from the part's 25 MHz internal oscillator, so a caller names the rate it wants
// rather than working the divider out.
byte prescale = Pca9685.PrescaleForFrequency(50);
Console.WriteLine(
$"prescale {prescale} gives {Pca9685.FrequencyForPrescale(prescale):F1} Hz");
// Each channel owns four consecutive registers, so a whole channel is written in
// one bus transaction rather than four.
Console.WriteLine($"channel 3 starts at register 0x{Pca9685.ChannelRegister(3):X2}");
// A centered hobby servo holds its output high for 1500 us of the 20 ms period.
// The part counts in 4096 steps per period, so that is where the pulse ends.
byte[] centered = Pwm.Servo(1500, 50);
Console.WriteLine($"centered servo goes low at count {Pwm.Counts(centered).Off} of 4096");
// Fully off carries its own flag rather than a zero duty, which would still hold
// the output high for the first count of every period.
bool flagged = Pwm.Counts(Pwm.FullOff()).Off != Pwm.Counts(Pwm.Duty(0)).Off;
Console.WriteLine($"full off flag set: {flagged}");
// A stepper is driven by walking a pattern of coil states. Half-step drive
// interleaves the one-coil and two-coil patterns, so it has twice as many.
using var motor = new Stepper(StepDrive.HalfStep);
Console.WriteLine($"coils {Convert.ToString(motor.Coils, 2).PadLeft(4, '0')} at rest");
for (int step = 0; step < 2; step++)
{
byte coils = motor.Step(StepDirection.Forward);
Console.WriteLine(
$"coils {Convert.ToString(coils, 2).PadLeft(4, '0')} after a step");
}
// The patterns wrap, so the motor runs indefinitely either way, and an angle
// converts to whole steps: a quarter turn of a 1.8-degree motor is fifty of them.
for (int step = 2; step < Stepper.StepCount(StepDrive.HalfStep); step++)
{
motor.Step(StepDirection.Forward);
}
Console.WriteLine(
$"coils {Convert.ToString(motor.Coils, 2).PadLeft(4, '0')} back at the start "
+ "of the cycle");
Console.WriteLine($"a quarter turn is {Stepper.StepsForDegrees(90.0f, 200)} steps");
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-actuators |
reference, docs.rs, install |
| TypeScript | @pamoja/actuators |
reference, install |
| Python | pamoja-actuators |
reference, install |
| C# | Pamoja.Actuators |
reference, install |
Documentation
Pamoja.Actuatorsreference, every type in this namespace.- The Actuator drivers guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Pamoja.Native (>= 0.1.18)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Pamoja.Actuators:
| Package | Downloads |
|---|---|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Sensing
Sensing and actuation: The parts wired to a board: a thermometer that checks its own bytes, a servo pulse, a stepper walking its coils, and a part of your own. |
GitHub repositories
This package is not used by any popular GitHub repositories.