提交 b0133d22 编写于 作者: M monty124 提交者: Jose Perez Rodriguez

pcf8574t/at (#502)

* pcf8574t/at

better working example for pcf8574t and working example for pcf8574at

* Adding project reference in order to fix build break
上级 0be56255
......@@ -34,14 +34,15 @@ using (var lcd = new LcdRgb1602(i2cLcdDevice, i2cRgbDevice))
}
```
PCF8574T Sample
The I2C backpack based on the PCF8574T IC uses specific pin mapping, to consume this device binding on this backpack use like so
PCF8574T/PCF8574AT Sample
The I2C backpack based on the PCF8574T/AT IC uses specific pin mapping, to consume this device binding on this backpack use like so
```c#
var i2cDevice = new UnixI2cDevice(new I2cConnectionSettings(busId: 1, deviceAddress: 0x27));
var controller = new Mcp23008(i2cDevice);
var controller = new Pcf8574(i2cDevice);
var lcd = new Lcd1602(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7}, backlightPin: 3, readWritePin: 1, controller: controller);
```
there is a full working example in the samples directory called Pcf8574tSample.cs
For PCF8574T i2c addresses can be between 0x27 and 0x20 depending on bridged solder jumpers and for PCF8574AT i2c addresses can be between 0x3f and 0x38 depending on bridged solder jumpers
## References
- Very complete tutorial on how to connect and work with one of these displays: https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/overview
......
......@@ -7,6 +7,7 @@
<ItemGroup>
<ProjectReference Include="../../Mcp23xxx/Mcp23xxx.csproj" />
<ProjectReference Include="../../Pcx857x/Pcx857x.csproj" />
<PackageReference Include="System.Device.Gpio" Version="$(SystemDeviceGpioPackageVersion)" />
<ProjectReference Include="..\CharacterLcd.csproj" />
</ItemGroup>
......
......@@ -9,7 +9,7 @@ using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Timers;
using Iot.Device.Mcp23xxx;
using Iot.Device.Pcx857x;
namespace Iot.Device.CharacterLcd.Samples
{
......@@ -24,9 +24,10 @@ namespace Iot.Device.CharacterLcd.Samples
public static void SampleEntryPoint()
{
Console.WriteLine("Starting...");
//for PCF8574T i2c addresses can be between 0x27 and 0x20 depending on bridged solder jumpers
//for PCF8574AT i2c addresses can be between 0x3f and 0x38 depending on bridged solder jumpers
var i2cDevice = new UnixI2cDevice(new I2cConnectionSettings(busId: 1, deviceAddress: 0x27));
var controller = new Mcp23008(i2cDevice);
var controller = new Pcf8574(i2cDevice);
var lcd = new Lcd1602(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7 }, backlightPin: 3, readWritePin: 1, controller: controller);
using (lcd)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册