Giter Site home page Giter Site logo

arrebagrove / magellanic.sensors.mcp9808 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeremylindsayni/magellanic.sensors.mcp9808

0.0 0.0 0.0 81 KB

C# code for the MCP9808 digital temperature sensor chip.

Home Page: https://jeremylindsayni.wordpress.com/2016/06/09/how-to-measure-temperature-using-c-raspberry-pi-windows-10-iot-core-and-the-adafruit-mcp9808-sensor/

C# 100.00%

magellanic.sensors.mcp9808's Introduction

Magellanic.Sensors.MCP8908

This is a C# implementation of code which integrates the MCP8908 temperature sensor with Windows 10 IoT Core on the Raspberry Pi 3.

Getting started

To build this project, you'll need the Magellanic.I2C project also (this is a NuGet package which is referenced in the project, so you may need to restore NuGet packages in your solution).

You should reference the Magellanic.Sensors.MCP8908 in your Visual Studio solution. The MCP8908 can be used with the following sample code from a blank Windows 10 UWP app:

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
 
        Loaded += MainPage_Loaded;
    }
 
    private async void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
    {
        try
        {
            var temperatureSensor = new MCP9808();

            await temperatureSensor.Initialize();

            if (temperatureSensor.IsConnected())
            {
                while(true)
                {
                    var temperature = temperatureSensor.GetTemperature();
            
                    Debug.WriteLine("Temperature = " + temperature);
            
                    Task.Delay(1000).Wait();
                }
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
    }
}

magellanic.sensors.mcp9808's People

Contributors

jeremylindsayni avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.