Renato Loureiro / Mbed 2 deprecated Astromed

Dependencies:   OLED160G1 mbed uOLED

Fork of DS18B20GSM by Renato Loureiro

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "stdint.h"
00003 #include "DS18B20.h"
00004 #include "OLED160G1.h"
00005 #include "uOLED.h"
00006 
00007 
00008 DigitalInOut sensor(p23);     //DS18b20 connected on pin 23
00009 
00010 OLED160G1 oled(p28, p27, p8);
00011 AnalogIn input(p20);          //Voltage meter
00012 
00013 Serial GSM(p13, p14);
00014 Serial pc(USBTX,USBRX);
00015 
00016 Ticker timer;                // used for our microsec timing
00017 
00018 float temp=0;
00019 
00020 
00021 unsigned char i = 0;
00022 unsigned char j = 0;
00023 char NumTel[] = "937831063";
00024 unsigned char CtrlZ = 0x1A;
00025 float volt=0;
00026 
00027 int main() {
00028 
00029 
00030 GSM.baud(9600);
00031 GSM.format(8,Serial::None,1);
00032 
00033     oled.init();
00034     oled.eraseScreen();
00035     oled.setTextBackgroundType(OLED_SET_TEXT_OPAQUE);
00036     oled.setFontSize(0);
00037     
00038     sensor.mode(PullUp);
00039     
00040     ROM_Code_t ROM_Code = ReadROM();
00041     
00042     oled.locate(0,1);
00043     oled.printf("Temp Actual..\n");
00044     
00045     while (1) {
00046     volt = input.read()*3.3;
00047     showTemperature(&temp);
00048        oled.locate(2,3);
00049        oled.setFontSize(2);
00050         oled.printf("%.2f C",temp);
00051         wait(600);
00052 
00053 
00054 GSM.printf("AT+CMGF=1\r\n");
00055 wait(1);
00056 
00057 GSM.printf("AT+CMGS=937831063\r\n");
00058 wait(1);
00059 
00060 GSM.printf("%.2f C\r\n",temp);
00061 GSM.printf("%.2f V\r\n", volt);
00062 GSM.printf("%c",CtrlZ);
00063 
00064 
00065 
00066     }
00067 }
00068