my code

Temperature Sensor to NI LabVIEW GUI

Reads 12 bit Temperature through I2Cand sends it through HID to LabVIEW Interface. Sensor is a sparkfun TMP102

Snippet options

Download: Download snippet as temperature-sensor-to-ni-labview-gui.c.
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

ButtonDuino Temperature Read to LabVIEW
Created      : 13 December 2013
Created By   : Lumina Inova
Description  : Reads 12 bit Temperature through I2C
               and sends it through HID to LabVIEW
Connections  : SDA => BtnDuino D0 to TMP102  SDA
               SCL => BtnDuino D2 to TMP102  SCL
               PWR => BtnDuino VCC to TMP102 VCC
               GND => BtnDuino GND to TMP102 GND  
               ADD  => TMP102 ADDRESS to GND 
Tutorial :

#include <TinyWireM.h>    
#include "DigiKeyboard.h"

int sensorAddress = 0x91 >> 1;    //Address of TMP102 Temperature Sensor 

byte msb;
byte lsb;
int temperature;

void setup(void)
void loop(){


 if (2 <= TinyWireM.available())               // if two bytes were received 
    msb = TinyWireM.receive();                 // receive high byte (full degrees)
    lsb =  TinyWireM.receive();                // receive low byte (fraction degrees) 
    temperature = ((msb) << 4);                // MSB
    temperature |= (lsb >> 4);                 // LSB
    DigiKeyboard.sendKeyStroke(0);             //Activate Read

    DigiKeyboard.println(temperature*0.0625);  //Display Temperature * Calibration Constant
   DigiKeyboard.delay(1000);                     //Delay so PC knows the connection is alive

Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.