Share via


Temperature Sample

This sample demonstrates the use of a custom emulator component with the .NET Micro Framework extensible emulator. The custom component simulates a temperature sensor, obtaining the current temperature from a control displayed in the emulator window. This allows you to see how the sample application reacts as you change the control, and thus the temperature value returned by the custom component.

The Visual Studio solution includes three projects:

  • SpiTemperatureDevice is the temperature sensor component for the emulator.
  • TemperatureEmulator is an emulator with the custom sensor component.
  • TemperatureSample is a simple thermostat application that uses the emulator.

Features

  • Shows how to write a custom emulator component
  • Shows how to attach a custom emulator component to an emulator by editing the Emulator.config file
  • Shows how to run an application in a custom emulator
  • Shows how to localize temperature display for Fahrenheit or Celsius

How To Build

  1. Navigate to the Microsoft .NET Micro Framework\Samples\Temperature subfolder of your My Documents folder.
  2. Open Temperature.sln in Visual Studio.
  3. Right-click the TemperatureEmulator project and choose Build. This is necessary to register the emulator so that applications can run in it.
  4. Right-click the TemperatureSample project and choose Properties. On the Micro Framework properties page, choose TemperatureEmulator as the device.
  5. Build the complete solution.

Note

Either the TemperatureEmulator or the TemperatureSample project can be set as the startup project. The solution runs the same in either case; however, only the project set as the startup project can be debugged. If you want to step through the code in the emulator, choose the TemperatureEmulator as the startup project. If you want to step through the thermostat application, choose TemperatureSample.