revised work

Dependents:   labbbbbb2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Temperature.h Source File

Temperature.h

00001 #ifndef TEMPERATURE_H
00002 #define TEMPERATURE_H
00003 
00004 /** My Temperature Sensor class.
00005  *  Used for Reading Temperature from PCB.
00006  *
00007  * Example:
00008  * @code
00009  * #include "mbed.h"
00010  * #include "Temperature.h"
00011  *
00012  * int main()
00013  *{
00014  *  Labb2 temp;
00015  *  temp.power_sensor(1);
00016  *  while(1 == 1)
00017  *  {
00018  *      float a = temp.get_temp();
00019  *      printf("Temperatur i C: %.2f ", a);   
00020  *      printf("\n"); 
00021  *      float b = temp.c_to_f(a);
00022  *      printf("Temperatur i F: %.2f ", b);   
00023  *      printf("\n\n");
00024  *  }
00025  *}
00026  * @endcode
00027  */
00028 
00029 class Labb2 {
00030 public:
00031     Labb2 (char Address);
00032     //!This function gets temperature in Celsius
00033     float get_temp();   
00034     //!This function starts sensor with 1 and stops with 0
00035     void power_sensor(int i);  
00036     //!This function converts temperature to Fahrenheit
00037     float c_to_f(float celsius);    
00038     private:
00039     float celsius;
00040     int i;
00041     char cAddress;
00042     DigitalOut sensor_en  ; // GPIO pin PC8 connected to the sensor
00043     
00044     I2C i2c; 
00045 }
00046 ;
00047 #endif