Maxim MAX6675 Cold-Junction-Compensated K-Thermocoupleto-Digital Converter (0°C to +1024°C) os2 and os5
Dependents: proyectoprueba3 proyectoRTOS proyectoRTOS2 proyectoRTOS ... more
max6675.h
- Committer:
- star297
- Date:
- 2019-05-09
- Revision:
- 0:7c1c768af92a
- Child:
- 2:74731b8476a0
File content as of revision 0:7c1c768af92a:
#ifndef max6675_h #define max6675_h #include "mbed.h" /* #include "mbed.h" #include "max6675.h" max6675 sensor(D5,D3,D6); //miso, sclk, cs Serial pc(USBTX,USBRX); int main() { pc.baud(921600); pc.printf("\033[0m\033[2J\033[HMAX6675 Thermocouple!\r\n\n\n"); int cf = 0; // 0 Centigrade, 1 Fahrenheit while (1) { float temp = sensor.gettemp(cf); if (cf) { printf(" Temp: %4.2f%cF \n\033[2K\033[1A",temp,176); } else { printf(" Temp: %4.2f%cC \n\033[2K\033[1A",temp,176); } wait_ms(250); // requires 250mS for temperature conversion process } } */ class max6675 { public: max6675(PinName miso, PinName sclk, PinName cs); // read temperature 0 Centigrade, 1 Fahrenheit float gettemp(int cf); private: SPI max; DigitalOut _cs; }; #endif