Hi Dave,
thanks!
Here is the code (I'm really sure it isn't the code because it work on the NP+1 and I'm not doing anything fancy and I'm 100% sure I'm reading from the correct register on the device and the address of the device is correct)
using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; namespace NetduinoPlusApplication_I2C_Example { public class Program { public static void Main() { Byte[] _data = new byte[1] { 0 }; I2CDevice adxl345 = new I2CDevice(new I2CDevice.Configuration(0x53, 100)); I2CDevice.I2CWriteTransaction write = I2CDevice.CreateWriteTransaction(new Byte[] { 0x00 }); I2CDevice.I2CReadTransaction read = I2CDevice.CreateReadTransaction(_data); I2CDevice.I2CTransaction[] actions = new I2CDevice.I2CTransaction[] { write, read }; adxl345.Execute(actions, 1000); Debug.Print(_data[0].ToString()); } } }
Egeorgiou,
SecretLabs.NETMF.Hardware.NetduinoPlus needs to be replaced with just SecretLabs.NETMF.Hardware.Netduino. This is a change with the new firmware.
Firmware Update Look at second post.A few quick notes (known issues, temporary workarounds, etc.):
In the meantime, if you are upgrading your Netduino Plus 1 projects to Netduino Plus 2:
- Remove the SecretLabs.NETMF.Hardware.NetduinoPlus.dll reference from your project.
- Add the SecretLabs.NETMF.Hardware.Netduino.dll reference to your project
- Change the deployment target in Project Properties > .NET Micro Framework.
I tried your code on my NP2, at the first deploy it didn't work but I had no done this step "Change the deployment target in Project Properties > .NET Micro Framework." chnge to .NET Micro Framework 3.0 then back to 4.2 and the program deployed to the NP2. The output is shown in the picture
Chuck