My Netduino Plus 2 just arrived today. I have done a quick test of the OneWire (1-wire) support with a DS18B20 temperature sensor.
Be sure to add the reference to Microsoft.SPOT.Hardware.OneWire in your project.
Looking at the flat side of the sensor, the left pin is connected to GND, the center pin is connected to digital pin 0, and the right pin is connected to 5V. There is a 4k7 pull-up resistor between 5V and the center pin.
The following code reads the temperature every 10 seconds, converts it to Fahrenheit , and prints the result to the debugging output panel.
public class Program
public static void Main()
DS18B20 t = new DS18B20(Pins.GPIO_PIN_D0);
float temp = t.ConvertAndReadTemperature();
temp = temp / 5 * 9 + 32;
Update (1/21/13): I have posted a multi-device version of this code.
Update (3/29/13): For subfreezing temperatures, see this post.