Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
Syntax
public class As5013 : SamplingSensorBase<AnalogJoystickPosition>, IObservable<IChangeResult<AnalogJoystickPosition>>, ISamplingSensor<AnalogJoystickPosition>, ISensor<AnalogJoystickPosition>, IAnalogJoystick, II2cPeripheral
Constructors
As5013(II2cBus, byte, IDigitalInterruptPort)
Create a new As5013 object
Declaration
public As5013(II2cBus i2cBus, byte address = 64, IDigitalInterruptPort interruptPort = null)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | the I2C bus |
byte | address | the device I2C address |
IDigitalInterruptPort | interruptPort | port connected to the interrupt pin |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
Fields
i2cComms
I2C Communication bus used to communicate with the peripheral
Declaration
protected readonly II2cCommunications i2cComms
Field Value
Type | Description |
---|---|
II2cCommunications |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
Properties
DefaultI2cAddress
The default I2C address for the peripheral
Declaration
public byte DefaultI2cAddress { get; }
Property Value
Type | Description |
---|---|
byte |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
DefaultSpeed
Default I2C bus speed
Declaration
public I2cBusSpeed DefaultSpeed { get; }
Property Value
Type | Description |
---|---|
I2cBusSpeed |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
DigitalPosition
The digital joystick position
Declaration
public DigitalJoystickPosition? DigitalPosition { get; }
Property Value
Type | Description |
---|---|
DigitalJoystickPosition? |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
IsHorizontalInverted
Is the horizontal analog value inverted
Declaration
public bool IsHorizontalInverted { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
IsVerticalHorizonalSwapped
Swap horizonal and vertical
Declaration
public bool IsVerticalHorizonalSwapped { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
IsVerticalInverted
Is the vertical analog value inverted
Declaration
public bool IsVerticalInverted { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
Position
The joystick position
Declaration
public AnalogJoystickPosition? Position { get; }
Property Value
Type | Description |
---|---|
AnalogJoystickPosition? |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
Methods
DisableInterrupt()
Disable the interrupt pin
Declaration
public void DisableInterrupt()
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
EnableInterrupt()
enable the interrupt pin
Declaration
public void EnableInterrupt()
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
InvertSpinning()
Invert the channel voltage function
Declaration
public void InvertSpinning()
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
ReadSensor()
Convenience method to get the current position
Declaration
protected override Task<AnalogJoystickPosition> ReadSensor()
Returns
Type | Description |
---|---|
Task<AnalogJoystickPosition> |
Overrides
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
SetDefaultConfiguration()
Set the default configuration
Declaration
public void SetDefaultConfiguration()
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
SetLowPowerMode(byte)
Set the device into low power mode
Declaration
public void SetLowPowerMode(byte timing)
Parameters
Type | Name | Description |
---|---|---|
byte | timing | timing between reads |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
SetScalingFactor(byte)
Set the data scaling factor from the hall sensor (see datasheet)
Declaration
public void SetScalingFactor(byte scalingFactor)
Parameters
Type | Name | Description |
---|---|---|
byte | scalingFactor |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
SoftReset()
Soft reset the IC
Declaration
public void SoftReset()
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
StartUpdating(TimeSpan?)
Starts continuously sampling the sensor
This method also starts raising Changed
events and IObservable
subscribers getting notified. Use the readIntervalDuration
parameter
to specify how often events and notifications are raised/sent.
Declaration
public override void StartUpdating(TimeSpan? updateInterval)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan? | updateInterval | A |
Overrides
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
StopUpdating()
Stops sampling the joystick position
Declaration
public override void StopUpdating()
Overrides
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
Events
Interrupt
Event if interrupt port is provided for interrupt pin
Declaration
public event EventHandler Interrupt
Event Type
Type | Description |
---|---|
EventHandler |
Remarks
As5013 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
As5013 joystick;
public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");
joystick = new As5013(Device.CreateI2cBus());
joystick.Updated += As5013_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
joystick.StartUpdating(TimeSpan.FromMilliseconds(100));
return Task.CompletedTask;
}
private void As5013_Updated(object sender, IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition> e)
{
Resolver.Log.Info($"{e.New.Horizontal}, {e.New.Vertical}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a As5013 to your Meadow board, connect the following:
As5013 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |