jlñkjfasña

Dependencies:   mbed TextLCD max6675

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "max6675.h"
00003 #include "rtos.h"
00004 #include "TextLCD.h"
00005 
00006 I2C i2c_lcd(D7,D6);
00007 TextLCD_I2C lcd(&i2c_lcd, 0x4E,  TextLCD::LCD16x2, TextLCD::HD44780);
00008 max6675 sensor(D12,D13,D5);
00009 Serial pc(USBTX,USBRX);
00010 Thread thread;
00011 
00012 Thread thread2;
00013 Thread thread3;
00014 
00015 
00016 void pantallalcd()
00017 {
00018     lcd.setMode(TextLCD::DispOn);
00019     lcd.setBacklight(TextLCD::LightOn);
00020     lcd.setCursor(TextLCD::CurOff_BlkOff);
00021 }
00022 
00023 void temp_hora()
00024 {
00025     int cf = 1;
00026     while (1) {
00027        
00028         float temp = sensor.gettemp(cf);
00029         lcd.locate(0,0);
00030         lcd.printf("temp:%1.2f",temp);
00031         Thread::wait(1000);
00032     }
00033 }
00034 
00035 
00036 int main()
00037 {
00038     thread2.start ((temp_hora));
00039     thread3.start((pantallalcd));
00040     thread.join();
00041     
00042 }