title: Raspberry Pi, Windows IoT, C#
body: <p>I am currently experimenting with my Raspberry Pi with Grove sensors and Windows IoT. I am trying to transfer information from the Raspberry Pi to Azure and I receive an error (In line 85). </p>
  
  <p>The code looks this way:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Net.Http;
  using Windows.ApplicationModel.Background;
  using GrovePi;
  using GrovePi.I2CDevices;
  using GrovePi.Sensors;
  using GrovePi.Common;
  using System.Threading.Tasks;
  using Microsoft.Azure.Devices.Client;
  using Newtonsoft.Json;
  
  // The Background Application template is documented at http://go.microsoft.com/fwlink/?LinkID=533884&amp;clcid=0x409
  
  namespace GrooveTHS
  {
      public sealed class StartupTask : IBackgroundTask
      {
          IRgbLcdDisplay LCDDisplay;
          public void Run(IBackgroundTaskInstance taskInstance)
          {
              IDHTTemperatureAndHumiditySensor sensor = DeviceFactory.Build.DHTTemperatureAndHumiditySensor(Pin.DigitalPin7, DHTModel.Dht11); // pinD7
              LCDDisplay = DeviceFactory.Build.RgbLcdDisplay(); // pinI2C-1
              IRotaryAngleSensor potentiometer = DeviceFactory.Build.RotaryAngleSensor(Pin.AnalogPin2); // pinA2
              ILed red = DeviceFactory.Build.Led(Pin.DigitalPin5); // pinD5
              ILed green = DeviceFactory.Build.Led(Pin.DigitalPin6); // pinD6
              IUltrasonicRangerSensor dsensor = DeviceFactory.Build.UltraSonicSensor(Pin.DigitalPin4); // pin D4
  
              double angle = 0;
              double tmax = 0;
  
              while (true)
              {
                  Task.Delay(500).Wait();
                  angle = potentiometer.SensorValue();
                  sensor.Measure();
                  string sensortemp = sensor.TemperatureInCelsius.ToString();
                  tmax = Math.Floor(angle / 10);
                  string sensorvalue = dsensor.MeasureInCentimeters().ToString();
                  if (sensor.TemperatureInCelsius &gt; tmax)
                  {
                      System.Diagnostics.Debug.WriteLine("Raumtemperatur: " + sensortemp + "C " + "Tmax: " + tmax.ToString() + "C");
  
                      red.AnalogWrite(Convert.ToByte(240));
                      green.AnalogWrite(Convert.ToByte(0));
                  }
                  else
                  {
                      System.Diagnostics.Debug.WriteLine("Raumtemperatur: " + sensortemp + "C" + "Tmax: " + tmax.ToString() + "C");
  
                      red.AnalogWrite(Convert.ToByte(0));
                      green.AnalogWrite(Convert.ToByte(240));
                  }
                  if (dsensor.MeasureInCentimeters() &lt; 150)
                  {
                      LCDDisplay.SetBacklightRgb(BitConverter.GetBytes(990)[0], BitConverter.GetBytes(990)[0], BitConverter.GetBytes(990)[0]);
                      LCDDisplay.SetText("Raumtemperatur: " + sensortemp + "C " + "Tmax: " + tmax.ToString() + "C");
                  }
                  else
                  {
                      LCDDisplay.SetText("");
                      LCDDisplay.SetBacklightRgb(BitConverter.GetBytes(0)[0], BitConverter.GetBytes(0)[0], BitConverter.GetBytes(0)[0]);
                  }
              }
          }
  
  
          static async void SendDeviceToCloudMessagesAsync(long inputDistance)
          {
              string iotHubUri = "IotHubAuburn.azure-devices.net"; // ! put in value !
              string deviceId = "jb"; // ! put in value !
              string deviceKey = "sHGJlQbLLMeMExNaqtvh8/7N7MHWlBZ0ESj2ePahSwQ="; // ! put in value !
              DateTime time = DateTime.UtcNow;
  
              var deviceClient = DeviceClient.Create(iotHubUri, AuthenticationMethodFactory.CreateAuthenticationWithRegistrySymmetricKey(deviceId, deviceKey), TransportType.Http1);
  
              JSON jsonStr = new JSON();
              jsonStr.distance = inputDistance;
              jsonStr.time = time;
              jsonStr.deviceId = deviceId;
              var list = JsonConvert.SerializeObject(jsonStr);
              System.Diagnostics.Debug.WriteLine(list);
              var message = new Message(Encoding.UTF8.GetBytes(list));
  
              await deviceClient.SendEventAsync(message);
          }
      }
  }
  </code></pre>
  
  <p>And errors I am getting are following (Translated from german language):</p>
  
  <blockquote>
    <p>1) CS0246 The type or a namespacename "JSON" was not found (maybe a
    using-derective or a reprimand assembly is missing).</p>
    
    <p>2) CS0246 The type or a namespacename "JSON" was not found (maybe a
    using-derective or a reprimand assembly is missing).</p>
  </blockquote>
  
  <p>Kind regards,</p>
  
  <p>Alex</p>