I’ve got another problem trying to make 4.2 work with my project on a EMX Spider.
After the upgrade to 4.2, I had to modify the code a bit since OneWire is now part of .Net MF instead of GHI lib.
Old code to search a device (working with a DS2413 on .Net MF 4.1):
mOneWire = new OneWire((Cpu.Pin)20);
byte[] romNumber = new byte[8];
if (mOneWire.Reset()) {
mOneWire.Search_Restart();
bool deviceFound = false;
do {
deviceFound = mOneWire.Search_GetNextDevice(romNumber);
if (deviceFound) {
Debug.Print("Device found");
}
} while (deviceFound == true);
}
New code (I tried a few ways to test):
try {
OneWire ow = new OneWire(new OutputPort(EMX.Pin.IO20, false));
int num = ow.FindFirstDevice(true, false);
int test = ow.TouchReset();
ArrayList deviceList = ow.FindAllDevices();
} catch {
}
All 3 methods above (FindFirstDevice(), TouchReset() and FindAllDevices) return 0 or empty list (but no exceptions)
Maybe I should not use Pin20 and try another?
Thanks for the help!