Paul Staron / max6675

Dependents:   proyectoprueba3 proyectoRTOS proyectoRTOS2 proyectoRTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers max6675.h Source File

max6675.h

00001 #ifndef max6675_h
00002 #define max6675_h
00003 
00004 #include "mbed.h"
00005 
00006 /*
00007 #include "mbed.h"
00008 #include "max6675.h"
00009 
00010 max6675 sensor(D5,D3,D6);  //miso, sclk, cs
00011 Serial pc(USBTX,USBRX);
00012 
00013 int main()
00014 {
00015     pc.baud(921600);
00016     pc.printf("\033[0m\033[2J\033[HMAX6675 Thermocouple!\r\n\n\n");
00017 
00018     int cf = 0; // 0 Centigrade, 1 Fahrenheit
00019 
00020     while (1) {
00021 
00022         float temp = sensor.gettemp(cf);
00023         if (cf) {
00024             printf(" Temp: %4.2f%cF \n\033[2K\033[1A",temp,176);
00025         } else {
00026             printf(" Temp: %4.2f%cC \n\033[2K\033[1A",temp,176);
00027         }
00028         wait_ms(250);   // requires 250mS for temperature conversion process
00029     }
00030 }
00031 */
00032 
00033 
00034 class max6675
00035 {    
00036   public:
00037   
00038     max6675(PinName miso, PinName sclk, PinName cs);
00039         
00040     // read temperature 0 Centigrade, 1 Fahrenheit       
00041     float gettemp(int cf);    
00042     
00043   private:  
00044     SPI max;
00045     DigitalOut _cs;
00046     Timer t;    
00047 };
00048 
00049 #endif