Meadow.Foundation.Sensors.Hid.As5013
| 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 |