Toolbox.NETMF.Hardware.Tmp36


Toolbox.NETMF.Hardware.Tmp36(AnalogPort)
  • AnalogPort The analog port the sensor is connected to

Parameters

  • Temperature The temperature in degrees celcius

How to connect

Toolbox.NETMF.Hardware.Tmp36.png

Sample code in C#

Tmp36 TemperatureSensor = new Tmp36(new Netduino.ADC(Pins.GPIO_PIN_A4));

while (true)
{
    float celcius = TemperatureSensor.Temperature;
    float kelvin = (float)(celcius + 273.15);
    float fahrenheit = (float)((celcius * 1.8) + 32.0);
    Debug.Print("Current temperature: " + celcius.ToString() + " celcius / " + kelvin.ToString() + " kelvin / " + fahrenheit.ToString() + " fahrenheit");
    Thread.Sleep(1000);
}

Sample code in VB

Dim TemperatureSensor As Tmp36 = New Tmp36(new Netduino.ADC(Pins.GPIO_PIN_A4))

Do
    Dim celcius As Double = TemperatureSensor.Temperature
    Dim kelvin As Double = celcius + 273.15
    Dim fahrenheit As Double = (celcius * 1.8) + 32.0

    Debug.Print("Current temperature: " + celcius.ToString() + " celcius / " + kelvin.ToString() + " kelvin / " + fahrenheit.ToString() + " fahrenheit")
    Thread.Sleep(1000)
Loop

Related documents

Last edited Jan 1, 2013 at 9:21 PM by Garrcomm, version 3