37 lines
886 B
C#
37 lines
886 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using SanShared;
|
|
using Tinkerforge;
|
|
|
|
namespace TempCAN
|
|
{
|
|
public class TinkerForgeTemperatur : ITemperature
|
|
{
|
|
private static string HOST = "localhost";
|
|
private static int PORT = 4223;
|
|
private static string UID = "dW3";
|
|
double temperatur;
|
|
|
|
public TinkerForgeTemperatur()
|
|
{
|
|
IPConnection ipcon = new IPConnection();
|
|
BrickletTemperature t = new BrickletTemperature(UID, ipcon);
|
|
|
|
ipcon.Connect(HOST, PORT);
|
|
short temp = t.GetTemperature();
|
|
temperatur = (temp / 100.0);
|
|
ipcon.Disconnect();
|
|
t = null;
|
|
ipcon = null;
|
|
}
|
|
|
|
public double GetTemperatur()
|
|
{
|
|
return temperatur;
|
|
}
|
|
}
|
|
}
|