Forum Discussion
tscholze
May 25, 2019Iron Contributor
How to send commands to a PIC16F1503 via I2C using C# and UWP?
Hi folks,
I want to port the following maker https://github.com/pimoroni/pantilt-hat of a https://shop.pimoroni.com/products/pan-tilt-hat to C#. I want to use it under the hood of an UWP app I'm currently writing.
But I'm really new to this topic and I do not understand how to send commands using I2C and the Windows.Devices.I2c package.
I tried e.g.:
private void WriteByte(byte command, byte[] data)
{
data.ToList().Insert(0, command);
data.ToArray();
pic16f1503.Write(data);
// OR
pic16f1503.Write(command);
pic16f1503.Write(data);
}
But nothing seems to work as I expect. Do I have to "tick" the clock by hand? I guess not.
I'm really thankful for each helping tipp. Thanks!
- Tobi from Germany
1 Reply
- -scien-Brass Contributor
perhaps try something like that:
byte[] I2CWriteBuffer = new byte[] {"private const byte"};
pic16f1503.Write(I2CWriteBuffer);