Jason Schilling / Mbed 2 deprecated miniProject7

Dependencies:   mbed TextLCD

Temperature.cpp

Committer:
nthompson22
Date:
2019-01-17
Revision:
4:19878f73f3e3
Parent:
3:7d5e3b2ed878
Child:
5:8582a28cf944

File content as of revision 4:19878f73f3e3:

#include "Temperature.h"
I2C i2cTemp(p9, p10);
    
float tempFar(float temp) {
    float far;
    far = (temp*9/5)+32;
    return far;
}

float tempRan(float temp) {
    float ran;
    ran = (temp*9/5)+491.67;
    return ran;
}

float tempKel(float temp){
    float kel;
    kel = temp+273;
    return kel;
}

void tempConfig(void) {
    
}

float readTemp(rawTemp) {
    short rawTemp;
    float temp;
    char buff[2];
    const int tempAddr = 0x90;
    tempSensor.read(tempAddr, buff, 2);
    rawTemp = (buff[0] <<8) + buff[1];
    rawTemp = rawTemp >> 4;
    temp = 0.0625 * rawTemp;
}