OneWire - Fez Panda II - which Libs

I’ve seen a lot of discussion about OneWire and libraries. I have a Fez Panda II and want to use OneWire. I have NETMF 4.2 installed. What libraries do I need?

For Panda II you need 4.1 NETMF and 4.1 GHI SDK.

See Legacy section at the bottom of this page:

https://www.ghielectronics.com/support/.net-micro-framework

And here the documentation about the OW class:

https://www.ghielectronics.com/downloads/man/Library_Documentation_v4.1/html/b33d5f99-cd45-14ee-99e8-8a8ebfa78181.htm

I think when I did the install I installed both 4.1 NETMF and 4.1 GHI SDK and then added 4.2 but not sure. I’ve been coding my Fez for awhile now and most functions fine. Should I just do install again of those two items? Do I need to uninstall anything?

Do you have Panda II project template in VS2010?

I don’t think so. If I go to New Project under installed templates in VS2010 Express I see “Gadgeteer” and “Micro Framework.” When I select “Micro Framework” then “Fez Panda II Application” is an option.

Ok, then you should have everything. Use Fez Panda II application option.

OK I am working on a Fez P II application and I have all the assemblies shown in the example for OneWire but when I type OneWire into the code it’s not recognized.

Did you add “using” statement for the namespace? Make sure you have added the reference for the assembly as well.

In the code below the only thing underlined in red is the two occurrences of the word OneWire.

In the references I have:
mscorlib
Microsoft.SPOT.Hardware
Microsoft.SPOT.Native
FEZPanda_II_GHIElectronics.NETMF.FEZ
System

using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;

namespace FPII_OW
{
    public class Program
    {
        public static void Main()
        {
            // Blink board LED

            bool ledState = false;

            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
            OutputPort owp = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.An1, true);

            OneWire ow = new OneWire(owp);
            
            while (true)
            {
                // Sleep for 500 milliseconds
                Thread.Sleep(500);

                // toggle LED state
                ledState = !ledState;
                led.Write(ledState);
            }
        }

    }
}

Add reference for:

GHIElectronics.NETMF.Hardware.dll

and add using statement to the code:

using GHIElectronics.NETMF.Hardware;

Thanks. Didn’t mean to be so slow but figuring out which assemblies and references is a bit confusing to me at times.

You are welcome. :slight_smile: