Hello every one!
( please don’t look at my english, i’m french )
i bought an I2C LCD on dealextreme.com but i don’t manage to use it …
i try to make some sketch with my teacher but it don’t work very well .
i give you the link of the lcd => [quote]http://dx.com/p/arduino-iic-i2c-serial-blue-backlight-lcd-2004-module-display-138616[/quote]
i use a FEZ panda II.
I give you the sketch i try
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.Threading;
namespace FEZ_Panda_II_TestI2C
{
public class Program
{
static I2CDevice.Configuration config = new I2CDevice.Configuration(0x20, 10);
static I2CDevice.I2CTransaction[] Init = new I2CDevice.I2CTransaction[1];
static I2CDevice.I2CTransaction[] t1 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] t2 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] t3 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] t4 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] t5 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] t6 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] t7 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] b4 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] b8 = new I2CDevice.I2CTransaction[2];
static I2CDevice.I2CTransaction[] Allumer = new I2CDevice.I2CTransaction[1];
static I2CDevice.I2CTransaction[] Donnee = new I2CDevice.I2CTransaction[4];
static I2CDevice LEDI2C = new I2CDevice(config);
public static void Main()
{
byte[] RegisterNum = new byte[1] { 0x08 };
Init[0] = I2CDevice.CreateWriteTransaction(RegisterNum);
Thread.Sleep(100);
Mettre4bit();
}
public static void Mettre4bit()
{
byte[] M1 = new byte[1] { 0x00 };
Init[0] = I2CDevice.CreateWriteTransaction(M1);
byte[] b1 = new byte[1] { 0x03 };
b8[0] = I2CDevice.CreateWriteTransaction(b1);
byte[] b2 = new byte[1] { 0x13 };
b8[1] = I2CDevice.CreateWriteTransaction(b2);
byte[] b41 = new byte[1] { 0x08 };
b4[0] = I2CDevice.CreateWriteTransaction(b41);
byte[] b42 = new byte[1] { 0x18 };
b4[1] = I2CDevice.CreateWriteTransaction(b42);
byte[] M2 = new byte[1] { 0x02 };
t1[0] = I2CDevice.CreateWriteTransaction(M2);
byte[] M3 = new byte[1] { 0x12 };
t1[1] = I2CDevice.CreateWriteTransaction(M3);
byte[] M4 = new byte[1] { 0x02 };
t2[0] = I2CDevice.CreateWriteTransaction(M4);
byte[] M5 = new byte[1] { 0x12 };
t2[1] = I2CDevice.CreateWriteTransaction(M5);
byte[] M6 = new byte[1] { 0x08 };
t3[0] = I2CDevice.CreateWriteTransaction(M6);
byte[] M7 = new byte[1] { 0x18 };
t3[1] = I2CDevice.CreateWriteTransaction(M7);
byte[] M8 = new byte[1] { 0x00 };
t4[0] = I2CDevice.CreateWriteTransaction(M8);
byte[] M9 = new byte[1] { 0x10 };
t4[1] = I2CDevice.CreateWriteTransaction(M9);
byte[] M10 = new byte[1] { 0x0E };
t5[0] = I2CDevice.CreateWriteTransaction(M10);
byte[] M11 = new byte[1] { 0x1E };
t5[1] = I2CDevice.CreateWriteTransaction(M11);
byte[] M12 = new byte[1] { 0x00 };
t6[0] = I2CDevice.CreateWriteTransaction(M12);
byte[] M13 = new byte[1] { 0x10 };
t6[1] = I2CDevice.CreateWriteTransaction(M13);
byte[] M18 = new byte[1] { 0x01 };
t7[0] = I2CDevice.CreateWriteTransaction(M12);
byte[] M19 = new byte[1] { 0x11 };
t7[1] = I2CDevice.CreateWriteTransaction(M13);
byte[] M14 = new byte[1] { 0x08 };
Allumer[0] = I2CDevice.CreateWriteTransaction(M14);
byte[] D1 = new byte[1] { 0x04 };
Donnee[0] = I2CDevice.CreateWriteTransaction(D1);
byte[] D2 = new byte[1] { 0x14 };
Donnee[1] = I2CDevice.CreateWriteTransaction(D2);
byte[] D3 = new byte[1] { 0x01 };
Donnee[2] = I2CDevice.CreateWriteTransaction(D3);
byte[] D4 = new byte[1] { 0x11 };
Donnee[3] = I2CDevice.CreateWriteTransaction(D4);
LEDI2C.Execute(Init, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(b8, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(b4, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t1, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t2, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t3, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t4, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t5, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t6, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(t7, 1000);
Thread.Sleep(1000);
LEDI2C.Execute(Allumer, 1000);
Thread.Sleep(500);
LEDI2C.Execute(Donnee, 1000);
Thread.Sleep(5000);
}
}
}
i found a librairy named LiquidCrystal made for arduino but i can’t use it.
So if someone find how to use it, i will be greatfull !
thanks !