Giter Club home page Giter Club logo

picontcthermistor's Introduction

PicoNTCThermistor

A C++ way to read a NTCThermistor for Raspberry Pico C/C++ SDK.

Getting started

Download this library

mkdir lib/
cd lib/
git clone https://github.com/ShellAddicted/PicoNTCThermistor

adjust your CMakeLists.txt accordingly:

# Add this line before target_link_libraries()
pico_add_subdirectory(lib/PicoNTCThermistor) 

# Add PicoNTCThermistor to your target_link_libraries()
# Example: target_link_libraries(PicoTest pico_stdlib PicoNTCThermistor)

Example:

#include <iostream>
#include "pico_ntc_thermistor.h"

int main() {
    stdio_init_all();
    adc_init();

    // Pin 27 = ADC1
    // 10e3 = 10k ohm (Known resistor)
    // 3950 = B value of the thermistor (Check your datasheet)
    // 100e3 = 100k ohm (Thermistor R @ T0)
    // 25°C = T0 (Usually 25, check your datasheet)
    // 0 = num of samples (0 = Single read)
    //     Increase this to get more accurate results, if samples > 0 the samples will be averaged
    NTCThermistor ntc(27, 10e3, 3950, 100e3, 25, 0);

    while (1) {
        printf("Temperature: %f°C\n", ntc.readTempC());
        sleep_ms(1000);
    }

    return 0;
}

License

This library is MIT licensed.

picontcthermistor's People

Contributors

shelladdicted avatar

Stargazers

JacquesB. avatar

Watchers

 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.