Yes, I'm a noob. Man, I'm glad I got that off my chest.
This is the first time I've attempted to hook up a sensor using I2C and I decided to start with this barometer from Adafruit.com: http://www.adafruit.com/products/391
Anyway (11 hours later), what I thought would be simple turned out to be not so simple. Here is what I am facing.
I have:
- A Netduino 2 running Firmware 4.2.2.1
- A Barometric Pressure sensor from Adafruit (BMP085) http://www.adafruit.com/products/391 (datasheet: http://www.adafruit....85-DS000-06.pdf)
- A headache
- And the following code:
byte[] Addr = new byte[2]; Addr[0] = 0xF4; Addr[1] = 0x34; byte[] TxBuff = new byte[4]; byte[] RxBuff = new byte[4]; I2CDevice.Configuration I2C_Configuration = new I2CDevice.Configuration(0x77, 400); I2CDevice I2C1 = new I2CDevice(I2C_Configuration); I2CDevice.I2CTransaction[] WriteTran = new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(Addr), I2CDevice.CreateWriteTransaction(TxBuff) }; I2CDevice.I2CTransaction[] ReadTran = new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(Addr), I2CDevice.CreateReadTransaction(RxBuff) }; while (true) { int iWriteCount = I2C1.Execute(WriteTran, 1000); Debug.Print("Write Count: " + iWriteCount.ToString()); Thread.Sleep(200); int iReadCount = I2C1.Execute(ReadTran, 1000); Debug.Print("Read Count: " + iReadCount.ToString()); string ReadOut = new string(System.Text.Encoding.UTF8.GetChars(RxBuff)); Debug.Print("EEPROM CONTENT:" + ReadOut); Thread.Sleep(200); }