testing

Dependencies:   ESP8266_Test_WIFI mbed-src

Files at this revision

API Documentation at this revision

Comitter:
hank51017
Date:
Tue Jun 28 11:03:39 2016 +0000
Parent:
2:dcaf0bcf6df6
Commit message:
for yotta;

Changed in this revision

ESP8266_Test_WIFI.lib Show annotated file Show diff for this revision Revisions of this file
I2C_SSD1306Z.cpp Show diff for this revision Revisions of this file
include/BME280.cpp Show annotated file Show diff for this revision Revisions of this file
include/BME280.h Show annotated file Show diff for this revision Revisions of this file
include/I2C_SSD1306Z.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 ESP8266_Test_WIFI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ESP8266_Test_WIFI.lib	Tue Jun 28 11:03:39 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ittraining_project_2016/code/ESP8266_Test_WIFI/#4c0f80896a21
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 I2C_SSD1306Z.cpp
--- a/I2C_SSD1306Z.cpp	Wed Jun 22 08:02:37 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +0,0 @@
-//
-// SSD1306Z LCD Driver: 0.96" lcd LY096BG30
-//
-// Interface: I2C
-// pin1: Vcc
-// pin2: Gnd
-// pin3: SCL
-// pin4: SDA
-
-#include "mbed.h"
-#include "I2C_SSD1306Z.h"
-#include "Font8x16.h"
-#include "Font5x7.h"
-
-
-//I2C i2c(I2C_SDA, I2C_SCL);
-extern I2C i2c;
-
-char DisplayBuffer[128*8];
-
-#if 1
-
-void lcdWriteCommand(uint8_t lcd_Command)
-{
-	
-	   char data[2];
-	   data[0]=0x0;
-	   data[1]=lcd_Command;
-    // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x00, 1, data);
-	// i2c_write_data_block(LCD_I2C_SLA, 0x00, data,1);
-	   i2c.write(LCD_I2C_SLA, data, 2, 0);
-	 
-}
-
-void lcdWriteData(uint8_t lcd_Data)
-{
-	
-	char data[2];
-	data[0]=0x40;
-	data[1]=lcd_Data;
-   //  I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x40, 1, data);	
-	//i2c_write_data_block(LCD_I2C_SLA, 0x40,data,1);
-	i2c.write(LCD_I2C_SLA, data, 2, 0);
-}
-
-#else
-
-void lcdWriteCommand(uint8_t lcd_Command)
-{
-	   uint8_t data[1];
-	   data[0]=lcd_Command;
-    // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x00, 1, data);
-	 i2c_write_data_block(LCD_I2C_SLA, 0x00, data,1);
-	 
-}
-
-void lcdWriteData(uint8_t lcd_Data)
-{
-	uint8_t data[1];
-	   data[0]=lcd_Data;
-   //  I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x40, 1, data);	
-	i2c_write_data_block(LCD_I2C_SLA, 0x40,data,1);
-}
-
-#endif
-
-void lcdSetAddr(uint8_t column, uint8_t page)
-{
-	lcdWriteCommand(0xb0+page);                     // set page address
-	lcdWriteCommand(0x10 | ((column & 0xf0) >> 4)); // set column address MSB
-	lcdWriteCommand(0x00 |  (column & 0x0f)      ); // set column address LSB
-}
-
-void Init_LCD(void)
-{
-	lcdWriteCommand(0xae); //display off
-	lcdWriteCommand(0x20);	//Set Memory Addressing Mode	
-	lcdWriteCommand(0x10);	//00,Horizontal Addressing Mode;01,Vertical Addressing Mode;10,Page Addressing Mode (RESET);11,Invalid
-	lcdWriteCommand(0xb0);	//Set Page Start Address for Page Addressing Mode,0-7
-	lcdWriteCommand(0xc8);	//Set COM Output Scan Direction
-	lcdWriteCommand(0x00);//---set low column address
-	lcdWriteCommand(0x10);//---set high column address
-	lcdWriteCommand(0x40);//--set start line address
-	lcdWriteCommand(0x81);//--set contrast control register
-	lcdWriteCommand(0x7f);
-	lcdWriteCommand(0xa1);//--set segment re-map 0 to 127
-	lcdWriteCommand(0xa6);//--set normal display
-	lcdWriteCommand(0xa8);//--set multiplex ratio(1 to 64)
-	lcdWriteCommand(0x3F);//
-	lcdWriteCommand(0xa4);//0xa4,Output follows RAM content;0xa5,Output ignores RAM content
-	lcdWriteCommand(0xd3);//-set display offset
-	lcdWriteCommand(0x00);//-not offset
-	lcdWriteCommand(0xd5);//--set display clock divide ratio/oscillator frequency
-	lcdWriteCommand(0xf0);//--set divide ratio
-	lcdWriteCommand(0xd9);//--set pre-charge period
-	lcdWriteCommand(0x22); //
-	lcdWriteCommand(0xda);//--set com pins hardware configuration
-	lcdWriteCommand(0x12);
-	lcdWriteCommand(0xdb);//--set vcomh
-	lcdWriteCommand(0x20);//0x20,0.77xVcc
-	lcdWriteCommand(0x8d);//--set DC-DC enable
-	lcdWriteCommand(0x14);//
-	lcdWriteCommand(0xaf);//--turn on lcd panel 
-}
-
-void clear_LCD(void)
-{
-	int16_t x, Y;
-	for (Y=0;Y<LCD_Ymax/8;Y++) 
-	{
-		lcdSetAddr(0, Y);
-	  for (x=0;x<LCD_Xmax;x++)
-	     lcdWriteData(0x00);
-	}
-}
-
-// print char function using Font5x7
-void printC_5x7 (int16_t x, int16_t y, unsigned char ascii_code) 
-{
-	uint8_t i;
-	if (x<(LCD_Xmax-5) && y<(LCD_Ymax-7)) {
-	   if      (ascii_code<0x20) ascii_code=0x20;
-     else if (ascii_code>0x7F) ascii_code=0x20;
-	   for (i=0;i<5;i++) {
-			  lcdSetAddr((LCD_Xmax+1-x-i), (y/8)); 
-        lcdWriteData(Font5x7[(ascii_code-0x20)*5+5-i]);
-		 }
-	}
-}
-
-void print_C(uint8_t Line, uint8_t Col, char ascii)
-{
-	uint8_t j, i, tmp;	
-	for (j=0;j<2;j++) {		
-	    lcdSetAddr(Col*8, Line*2+j);
-	    for (i=0;i<8;i++) {
-	      tmp=Font8x16[(ascii-0x20)*16+j*8+i];
-	      lcdWriteData(tmp);
-		  }
-  }
-}
-
-void print_Line(uint8_t line, char text[])
-{
-	uint8_t Col;
-	  for (Col=0; Col<strlen(text); Col++) 
-			print_C(line, Col, text[Col]);
-}
-
-void printS(int16_t x, int16_t y, char text[])
-{
-	int8_t i;
-	for (i=0;i<strlen(text);i++) 
-		print_C(x+i*8, y,text[i]);
-}
-
-void printS_5x7(int16_t x, int16_t y, char text[])
-{
-	uint8_t i;
-	for (i=0;i<strlen(text);i++) {
-		printC_5x7(x,y,text[i]);
-	  x=x+5;
-	}
-}
-
-void draw_Pixel(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor)
-{
-	if (fgColor!=0) 
-		DisplayBuffer[x+y/8*LCD_Xmax] |= (0x01<<(y%8));
-	else 
-		DisplayBuffer[x+y/8*LCD_Xmax] &= (0xFE<<(y%8));
-
-	lcdSetAddr(x, y/8);
-	lcdWriteData(DisplayBuffer[x+y/8*LCD_Xmax]);
-}
-
-void draw_Bmp8x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,k, kx,ky;
-	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
-		 for (i=0;i<8;i++){
-			   kx=x+i;
-				 t=bitmap[i];					 
-				 for (k=0;k<8;k++) {
-					      ky=y+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-				}
-		 }
-}
-
-void draw_Bmp32x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,k, kx,ky;
-	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
-		 for (i=0;i<32;i++){
-			   kx=x+i;
-				 t=bitmap[i];					 
-				 for (k=0;k<8;k++) {
-					      ky=y+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-				}
-		 }
-}
-
-void draw_Bmp120x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,k, kx,ky;
-	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
-		 for (i=0;i<120;i++){
-			   kx=x+i;
-				 t=bitmap[i];					 
-				 for (k=0;k<8;k++) {
-					      ky=y+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-				}
-		 }
-}
-
-void draw_Bmp8x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,k, kx,ky;
-	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
-		 for (i=0;i<8;i++){
-			   kx=x+i;
-				 t=bitmap[i];					 
-				 for (k=0;k<8;k++) {
-					      ky=y+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-				}
-				 t=bitmap[i+8];					 
-				 for (k=0;k<8;k++) {
-					      ky=y+k+8;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-				}				 
-		 }
-}
-
-void draw_Bmp16x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,k,kx,ky;
-	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-7)) // boundary check
-		 for (i=0;i<16;i++)
-	   {
-			   kx=x+i;
-				 t=bitmap[i];					 
-				 for (k=0;k<8;k++) {
-					      ky=y+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-					}
-		 }
-}
-
-void draw_Bmp16x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,j,k, kx,ky;
-	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-15)) // boundary check
-	   for (j=0;j<2; j++){		 
-		     for (i=0;i<16;i++) {	
-            kx=x+i;
-					  t=bitmap[i+j*16];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+j*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}
-		     }
-		 }
-}
-
-void draw_Bmp16x24(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,j,k, kx,ky;
-	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-15)) // boundary check
-	   for (j=0;j<3; j++){		 
-		     for (i=0;i<16;i++) {	
-            kx=x+i;
-					  t=bitmap[i+j*16];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+j*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}
-		     }
-		 }
-}
-
-void draw_Bmp16x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t, i,j,k, kx,ky;
-	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-31)) // boundary check
-	   for (j=0;j<4; j++)	{			 
-		     for (i=0;i<16;i++) {
-            kx=x+i;
-					  t=bitmap[i+j*16];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+j*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}					 
-		     }		 
-		 }
-}
-
-void draw_Bmp16x40(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t, i,j,k, kx,ky;
-	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-31)) // boundary check
-	   for (j=0;j<5; j++)	{			 
-		     for (i=0;i<16;i++) {
-            kx=x+i;
-					  t=bitmap[i+j*16];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+j*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}					 
-		     }		 
-		 }
-}
-
-void draw_Bmp16x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,j,k,kx,ky;
-	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-47)) // boundary check
-	   for (j=0;j<6; j++)	{
-         k=x;			 
-		     for (i=0;i<16;i++) {
-            kx=x+i;
-					  t=bitmap[i+j*16];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+j*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}						 
-		     }		 
-		 }
-}
-
-void draw_Bmp16x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,j,k,kx,ky;
-	if (x<(LCD_Xmax-15) && y==0) // boundary check
-	   for (j=0;j<8; j++) {
-				 k=x;
-		     for (i=0;i<16;i++) {
-            kx=x+i;
-					  t=bitmap[i+j*16];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+j*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}						 
-		     }
-		 }
-}
-
-void draw_Bmp32x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,jx,jy,k,kx,ky;
-	if (x<(LCD_Xmax-31) && y<(LCD_Ymax-15)) // boundary check
-		for (jy=0;jy<2;jy++)
-	   for (jx=0;jx<2;jx++)	{
-			   k=x;
-		     for (i=0;i<16;i++) {
-            kx=x+jx*16+i;
-					  t=bitmap[i+jx*16+jy*32];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+jy*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}						 
-		     }
-			}
-}
-
-void draw_Bmp32x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,jx,jy,k, kx,ky;
-	if (x<(LCD_Xmax-31) && y<(LCD_Ymax-31)) // boundary check
-		for (jy=0;jy<4;jy++)
-	   for (jx=0;jx<2;jx++)	{
-			   k=x;
-		     for (i=0;i<16;i++) {
-            kx=x+jx*16+i;
-					  t=bitmap[i+jx*16+jy*32];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+jy*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}						 
-		     }
-			}
-}
-
-void draw_Bmp32x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,jx,jy,k, kx,ky;
-	if (x<(LCD_Xmax-31) && y<(LCD_Ymax-47)) // boundary check
-		for (jy=0;jy<6;jy++)
-	   for (jx=0;jx<2;jx++)	{
-			   k=x;
-		     for (i=0;i<16;i++) {
-					  kx=x+jx*16+i;
-					  t=bitmap[i+jx*16+jy*32];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+jy*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}	
-		     }		 
-		 }
-}
-
-void draw_Bmp32x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t,i,jx,jy,k, kx,ky;
-	if (x<(LCD_Xmax-31) && y==0) // boundary check
-		for (jy=0;jy<8;jy++)
-	   for (jx=0;jx<2;jx++)	{
-			   k=x;
-		     for (i=0;i<16;i++) {
-					  kx=x+jx*16+i;
-					  t=bitmap[i+jx*16+jy*32];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+jy*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}						 
-		     }
-			}				 
-}
-
-void draw_Bmp64x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
-{
-	uint8_t t, i,jx,jy,k, kx,ky;
-	if (x<(LCD_Xmax-63) && y==0) // boundary check
-		for (jy=0;jy<8;jy++)
-	   for (jx=0;jx<4;jx++)	{
-	       k=x;
-		     for (i=0;i<16;i++) {
-					  kx=x+jx*16+i;
-					  t=bitmap[i+jx*16+jy*64];					 
-					  for (k=0;k<8;k++) {
-					      ky=y+jy*8+k;
-					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
-						}					 
-		     }
-			}
-}
-
-void draw_LCD(unsigned char *buffer)
-{
-  uint8_t x,y;
-	for (x=0; x<LCD_Xmax; x++) {
-    	for (y=0; y<(LCD_Ymax/8); y++) {
-			   lcdSetAddr(x ,y);
-			   lcdWriteData(buffer[x+y*LCD_Xmax]);
-			}
-		}			
-}
-
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 include/BME280.cpp
--- a/include/BME280.cpp	Wed Jun 22 08:02:37 2016 +0000
+++ b/include/BME280.cpp	Tue Jun 28 11:03:39 2016 +0000
@@ -50,11 +50,11 @@
     i2c.write(address, cmd, 2);
  
     cmd[0] = 0xf4; // ctrl_meas
-    cmd[1] = 0x27; // Temparature oversampling x1, Pressure oversampling x1, Normal mode
+    cmd[1] = 0xab; // Temparature oversampling x2, Pressure oversampling x16, Normal mode
     i2c.write(address, cmd, 2);
  
     cmd[0] = 0xf5; // config
-    cmd[1] = 0xa0; // Standby 1000ms, Filter off
+    cmd[1] = 0x10; // Standby 0.5ms, Filter 16
     i2c.write(address, cmd, 2);
  
     cmd[0] = 0x88; // read dig_T regs
@@ -102,8 +102,8 @@
  
 float BME280::getTemperature()
 {
-    uint32_t temp_raw;
-    float tempf;
+    int32_t temp_raw;
+    //double tempf;
     char cmd[4];
  
     cmd[0] = 0xfa; // temp_msb
@@ -111,37 +111,62 @@
     i2c.read(address, &cmd[1], 3);
  
     temp_raw = (cmd[1] << 12) | (cmd[2] << 4) | (cmd[3] >> 4);
+    
+    
+    double var1, var2, T;
+
+  var1 = (((double)temp_raw)/16384.0 - ((double)dig_T1)/1024.0) * ((double)dig_T2);
+  var2 = ((((double)temp_raw)/131072.0 - ((double)dig_T1)/8192.0) *
+  (((double)temp_raw)/131072.0 - ((double) dig_T1)/8192.0)) * ((double)dig_T3);
+  t_fine = (uint32_t)(var1 + var2);
+  T = (var1 + var2) / 5120.0;
+  return T;
  
-    int32_t temp;
+  /*  int32_t temp; //wrong formula
  
     temp =
         (((((temp_raw >> 3) - (dig_T1 << 1))) * dig_T2) >> 11) +
-        ((((((temp_raw >> 4) - dig_T1) * ((temp_raw >> 4) - dig_T1)) >> 12) * dig_T3) >> 14);
+        ((((((temp_raw >> 4) - dig_T1) * ((temp_raw >> 4) - (int32_t)dig_T1)) >> 12) * (int32_t)dig_T3) >> 14);
  
     t_fine = temp;
     temp = (temp * 5 + 128) >> 8;
-    tempf = (float)temp;
+    tempf = (double)temp;
  
-    return (((tempf/100.0f)-32)*5/9);
+    return (tempf/100.0f);*/
 }
  
 float BME280::getPressure()
 {
-    uint32_t press_raw;
-    float pressf;
+    int32_t press_raw;
+    //float pressf;
     char cmd[4];
-    int i;
+    //int i;
  
     cmd[0] = 0xf7; // press_msb
     i2c.write(address, cmd, 1);
     i2c.read(address, &cmd[1], 3);
     
-    for(i=0;i<4;i++)
-        printf("cmdp[%d] = %x\r\n", i,cmd[i]);
  
     press_raw = (cmd[1] << 12) | (cmd[2] << 4) | (cmd[3] >> 4);
+    double var1, var2, p;
+
+  var1 = ((double)t_fine/2.0) - 64000.0;
+  var2 = var1 * var1 * ((double)dig_P6) / 32768.0;
+  var2 = var2 + var1 * ((double)dig_P5) * 2.0;
+  var2 = (var2/4.0)+(((double)dig_P4) * 65536.0);
+  var1 = (((double)dig_P3) * var1 * var1 / 524288.0 + ((double)dig_P2) * var1) / 524288.0;
+  var1 = (1.0 + var1 / 32768.0)*((double)dig_P1);
+  if (var1 == 0.0) {
+    return 0; // avoid exception caused by division by zero
+  }
+  p = 1048576.0 - (double)press_raw;
+  p = (p - (var2 / 4096.0)) * 6250.0 / var1;
+  var1 = ((double)dig_P9) * p * p / 2147483648.0;
+  var2 = p * ((double)dig_P8) / 32768.0;
+  p = p + (var1 + var2 + ((double)dig_P7)) / 16.0;
+  return (p/100.0f);
  
-    int32_t var1, var2;
+  /*  int32_t var1, var2;
     uint32_t press;
  
     var1 = (t_fine >> 1) - 64000;
@@ -164,32 +189,43 @@
     press = (press + ((var1 + var2 + dig_P7) >> 4));
  
     pressf = (float)press;
-    return (pressf/100.0f);
+    return (pressf/100.0f);*/
 }
  
 float BME280::getHumidity()
 {
-    uint32_t hum_raw;
-    float humf;
-    char cmd[16];
-    int i;
+    int32_t hum_raw;
+    //float humf;
+    char cmd[4];
+
     
+     
     
     cmd[0] = 0xfd; // hum_msb
     i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[1], 2);
+    i2c.read(address, cmd, 4);
     
    
  
-    printf("address2 = %x\r\n", address);
-    for(i=0;i<16;i++)
-        printf("cmd[%d] = %x\r\n", i,cmd[i]);
+ 
+    hum_raw = (cmd[3] << 8) | cmd[2];
+    
+    
+    double var_H;
  
-    hum_raw = (cmd[1] << 8) | cmd[2];
+  var_H = (((double)t_fine) - 76800.0);
+  var_H = (hum_raw - (((double)dig_H4) * 64.0 + ((double)dig_H5) / 16384.0 * var_H)) *
+          (((double)dig_H2) / 65536.0 * (1.0 + ((double)dig_H6) / 67108864.0 * var_H *
+          (1.0 + ((double)dig_H3) / 67108864.0 * var_H)));
+  var_H = var_H * (1.0 - ((double)dig_H1) * var_H / 524288.0);
+  if (var_H > 100.0) {
+    var_H = 100.0;
+  } else if (var_H < 0.0) {
+    var_H = 0.0;
+  }  
+  return var_H;
     
-    printf("hum_raw = %x\r\n", hum_raw);
-    
-    int32_t v_x1;
+ /*   int32_t v_x1;
  
     v_x1 = t_fine - 76800;
     
@@ -208,6 +244,6 @@
     
     humf = (int32_t)(v_x1 >> 12);
  
-    return (humf/1024.0f);
+    return (humf/1024.0f);*/
 
 }
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 include/BME280.h
--- a/include/BME280.h	Wed Jun 22 08:02:37 2016 +0000
+++ b/include/BME280.h	Tue Jun 28 11:03:39 2016 +0000
@@ -92,7 +92,7 @@
     int16_t     dig_T2, dig_T3;
     uint16_t    dig_P1;
     int16_t     dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9;
-    uint16_t    dig_H1, dig_H3;
+    uint8_t     dig_H1, dig_H3;
     int16_t     dig_H2, dig_H4, dig_H5, dig_H6;
     int32_t     t_fine;
 
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 include/I2C_SSD1306Z.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/I2C_SSD1306Z.cpp	Tue Jun 28 11:03:39 2016 +0000
@@ -0,0 +1,451 @@
+//
+// SSD1306Z LCD Driver: 0.96" lcd LY096BG30
+//
+// Interface: I2C
+// pin1: Vcc
+// pin2: Gnd
+// pin3: SCL
+// pin4: SDA
+
+#include "mbed.h"
+#include "I2C_SSD1306Z.h"
+#include "Font8x16.h"
+#include "Font5x7.h"
+
+
+//I2C i2c(I2C_SDA, I2C_SCL);
+extern I2C i2c;
+
+char DisplayBuffer[128*8];
+
+#if 1
+
+void lcdWriteCommand(uint8_t lcd_Command)
+{
+	
+	   char data[2];
+	   data[0]=0x0;
+	   data[1]=lcd_Command;
+    // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x00, 1, data);
+	// i2c_write_data_block(LCD_I2C_SLA, 0x00, data,1);
+	   i2c.write(LCD_I2C_SLA, data, 2, 0);
+	 
+}
+
+void lcdWriteData(uint8_t lcd_Data)
+{
+	
+	char data[2];
+	data[0]=0x40;
+	data[1]=lcd_Data;
+   //  I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x40, 1, data);	
+	//i2c_write_data_block(LCD_I2C_SLA, 0x40,data,1);
+	i2c.write(LCD_I2C_SLA, data, 2, 0);
+}
+
+#else
+
+void lcdWriteCommand(uint8_t lcd_Command)
+{
+	   uint8_t data[1];
+	   data[0]=lcd_Command;
+    // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x00, 1, data);
+	 i2c_write_data_block(LCD_I2C_SLA, 0x00, data,1);
+	 
+}
+
+void lcdWriteData(uint8_t lcd_Data)
+{
+	uint8_t data[1];
+	   data[0]=lcd_Data;
+   //  I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x40, 1, data);	
+	i2c_write_data_block(LCD_I2C_SLA, 0x40,data,1);
+}
+
+#endif
+
+void lcdSetAddr(uint8_t column, uint8_t page)
+{
+	lcdWriteCommand(0xb0+page);                     // set page address
+	lcdWriteCommand(0x10 | ((column & 0xf0) >> 4)); // set column address MSB
+	lcdWriteCommand(0x00 |  (column & 0x0f)      ); // set column address LSB
+}
+
+void Init_LCD(void)
+{
+	lcdWriteCommand(0xae); //display off
+	lcdWriteCommand(0x20);	//Set Memory Addressing Mode	
+	lcdWriteCommand(0x10);	//00,Horizontal Addressing Mode;01,Vertical Addressing Mode;10,Page Addressing Mode (RESET);11,Invalid
+	lcdWriteCommand(0xb0);	//Set Page Start Address for Page Addressing Mode,0-7
+	lcdWriteCommand(0xc8);	//Set COM Output Scan Direction
+	lcdWriteCommand(0x00);//---set low column address
+	lcdWriteCommand(0x10);//---set high column address
+	lcdWriteCommand(0x40);//--set start line address
+	lcdWriteCommand(0x81);//--set contrast control register
+	lcdWriteCommand(0x7f);
+	lcdWriteCommand(0xa1);//--set segment re-map 0 to 127
+	lcdWriteCommand(0xa6);//--set normal display
+	lcdWriteCommand(0xa8);//--set multiplex ratio(1 to 64)
+	lcdWriteCommand(0x3F);//
+	lcdWriteCommand(0xa4);//0xa4,Output follows RAM content;0xa5,Output ignores RAM content
+	lcdWriteCommand(0xd3);//-set display offset
+	lcdWriteCommand(0x00);//-not offset
+	lcdWriteCommand(0xd5);//--set display clock divide ratio/oscillator frequency
+	lcdWriteCommand(0xf0);//--set divide ratio
+	lcdWriteCommand(0xd9);//--set pre-charge period
+	lcdWriteCommand(0x22); //
+	lcdWriteCommand(0xda);//--set com pins hardware configuration
+	lcdWriteCommand(0x12);
+	lcdWriteCommand(0xdb);//--set vcomh
+	lcdWriteCommand(0x20);//0x20,0.77xVcc
+	lcdWriteCommand(0x8d);//--set DC-DC enable
+	lcdWriteCommand(0x14);//
+	lcdWriteCommand(0xaf);//--turn on lcd panel 
+}
+
+void clear_LCD(void)
+{
+	int16_t x, Y;
+	for (Y=0;Y<LCD_Ymax/8;Y++) 
+	{
+		lcdSetAddr(0, Y);
+	  for (x=0;x<LCD_Xmax;x++)
+	     lcdWriteData(0x00);
+	}
+}
+
+// print char function using Font5x7
+void printC_5x7 (int16_t x, int16_t y, unsigned char ascii_code) 
+{
+	uint8_t i;
+	if (x<(LCD_Xmax-5) && y<(LCD_Ymax-7)) {
+	   if      (ascii_code<0x20) ascii_code=0x20;
+     else if (ascii_code>0x7F) ascii_code=0x20;
+	   for (i=0;i<5;i++) {
+			  lcdSetAddr((LCD_Xmax+1-x-i), (y/8)); 
+        lcdWriteData(Font5x7[(ascii_code-0x20)*5+5-i]);
+		 }
+	}
+}
+
+void print_C(uint8_t Line, uint8_t Col, char ascii)
+{
+	uint8_t j, i, tmp;	
+	for (j=0;j<2;j++) {		
+	    lcdSetAddr(Col*8, Line*2+j);
+	    for (i=0;i<8;i++) {
+	      tmp=Font8x16[(ascii-0x20)*16+j*8+i];
+	      lcdWriteData(tmp);
+		  }
+  }
+}
+
+void print_Line(uint8_t line, char text[])
+{
+	uint8_t Col;
+	  for (Col=0; Col<strlen(text); Col++) 
+			print_C(line, Col, text[Col]);
+}
+
+void printS(int16_t x, int16_t y, char text[])
+{
+	int8_t i;
+	for (i=0;i<strlen(text);i++) 
+		print_C(x+i*8, y,text[i]);
+}
+
+void printS_5x7(int16_t x, int16_t y, char text[])
+{
+	uint8_t i;
+	for (i=0;i<strlen(text);i++) {
+		printC_5x7(x,y,text[i]);
+	  x=x+5;
+	}
+}
+
+void draw_Pixel(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor)
+{
+	if (fgColor!=0) 
+		DisplayBuffer[x+y/8*LCD_Xmax] |= (0x01<<(y%8));
+	else 
+		DisplayBuffer[x+y/8*LCD_Xmax] &= (0xFE<<(y%8));
+
+	lcdSetAddr(x, y/8);
+	lcdWriteData(DisplayBuffer[x+y/8*LCD_Xmax]);
+}
+
+void draw_Bmp8x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,k, kx,ky;
+	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
+		 for (i=0;i<8;i++){
+			   kx=x+i;
+				 t=bitmap[i];					 
+				 for (k=0;k<8;k++) {
+					      ky=y+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+				}
+		 }
+}
+
+void draw_Bmp32x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,k, kx,ky;
+	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
+		 for (i=0;i<32;i++){
+			   kx=x+i;
+				 t=bitmap[i];					 
+				 for (k=0;k<8;k++) {
+					      ky=y+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+				}
+		 }
+}
+
+void draw_Bmp120x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,k, kx,ky;
+	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
+		 for (i=0;i<120;i++){
+			   kx=x+i;
+				 t=bitmap[i];					 
+				 for (k=0;k<8;k++) {
+					      ky=y+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+				}
+		 }
+}
+
+void draw_Bmp8x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,k, kx,ky;
+	if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check		
+		 for (i=0;i<8;i++){
+			   kx=x+i;
+				 t=bitmap[i];					 
+				 for (k=0;k<8;k++) {
+					      ky=y+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+				}
+				 t=bitmap[i+8];					 
+				 for (k=0;k<8;k++) {
+					      ky=y+k+8;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+				}				 
+		 }
+}
+
+void draw_Bmp16x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,k,kx,ky;
+	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-7)) // boundary check
+		 for (i=0;i<16;i++)
+	   {
+			   kx=x+i;
+				 t=bitmap[i];					 
+				 for (k=0;k<8;k++) {
+					      ky=y+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+					}
+		 }
+}
+
+void draw_Bmp16x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,j,k, kx,ky;
+	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-15)) // boundary check
+	   for (j=0;j<2; j++){		 
+		     for (i=0;i<16;i++) {	
+            kx=x+i;
+					  t=bitmap[i+j*16];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+j*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}
+		     }
+		 }
+}
+
+void draw_Bmp16x24(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,j,k, kx,ky;
+	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-15)) // boundary check
+	   for (j=0;j<3; j++){		 
+		     for (i=0;i<16;i++) {	
+            kx=x+i;
+					  t=bitmap[i+j*16];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+j*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}
+		     }
+		 }
+}
+
+void draw_Bmp16x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t, i,j,k, kx,ky;
+	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-31)) // boundary check
+	   for (j=0;j<4; j++)	{			 
+		     for (i=0;i<16;i++) {
+            kx=x+i;
+					  t=bitmap[i+j*16];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+j*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}					 
+		     }		 
+		 }
+}
+
+void draw_Bmp16x40(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t, i,j,k, kx,ky;
+	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-31)) // boundary check
+	   for (j=0;j<5; j++)	{			 
+		     for (i=0;i<16;i++) {
+            kx=x+i;
+					  t=bitmap[i+j*16];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+j*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}					 
+		     }		 
+		 }
+}
+
+void draw_Bmp16x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,j,k,kx,ky;
+	if (x<(LCD_Xmax-15) && y<(LCD_Ymax-47)) // boundary check
+	   for (j=0;j<6; j++)	{
+         k=x;			 
+		     for (i=0;i<16;i++) {
+            kx=x+i;
+					  t=bitmap[i+j*16];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+j*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}						 
+		     }		 
+		 }
+}
+
+void draw_Bmp16x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,j,k,kx,ky;
+	if (x<(LCD_Xmax-15) && y==0) // boundary check
+	   for (j=0;j<8; j++) {
+				 k=x;
+		     for (i=0;i<16;i++) {
+            kx=x+i;
+					  t=bitmap[i+j*16];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+j*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}						 
+		     }
+		 }
+}
+
+void draw_Bmp32x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,jx,jy,k,kx,ky;
+	if (x<(LCD_Xmax-31) && y<(LCD_Ymax-15)) // boundary check
+		for (jy=0;jy<2;jy++)
+	   for (jx=0;jx<2;jx++)	{
+			   k=x;
+		     for (i=0;i<16;i++) {
+            kx=x+jx*16+i;
+					  t=bitmap[i+jx*16+jy*32];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+jy*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}						 
+		     }
+			}
+}
+
+void draw_Bmp32x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,jx,jy,k, kx,ky;
+	if (x<(LCD_Xmax-31) && y<(LCD_Ymax-31)) // boundary check
+		for (jy=0;jy<4;jy++)
+	   for (jx=0;jx<2;jx++)	{
+			   k=x;
+		     for (i=0;i<16;i++) {
+            kx=x+jx*16+i;
+					  t=bitmap[i+jx*16+jy*32];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+jy*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}						 
+		     }
+			}
+}
+
+void draw_Bmp32x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,jx,jy,k, kx,ky;
+	if (x<(LCD_Xmax-31) && y<(LCD_Ymax-47)) // boundary check
+		for (jy=0;jy<6;jy++)
+	   for (jx=0;jx<2;jx++)	{
+			   k=x;
+		     for (i=0;i<16;i++) {
+					  kx=x+jx*16+i;
+					  t=bitmap[i+jx*16+jy*32];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+jy*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}	
+		     }		 
+		 }
+}
+
+void draw_Bmp32x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t,i,jx,jy,k, kx,ky;
+	if (x<(LCD_Xmax-31) && y==0) // boundary check
+		for (jy=0;jy<8;jy++)
+	   for (jx=0;jx<2;jx++)	{
+			   k=x;
+		     for (i=0;i<16;i++) {
+					  kx=x+jx*16+i;
+					  t=bitmap[i+jx*16+jy*32];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+jy*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}						 
+		     }
+			}				 
+}
+
+void draw_Bmp64x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[])
+{
+	uint8_t t, i,jx,jy,k, kx,ky;
+	if (x<(LCD_Xmax-63) && y==0) // boundary check
+		for (jy=0;jy<8;jy++)
+	   for (jx=0;jx<4;jx++)	{
+	       k=x;
+		     for (i=0;i<16;i++) {
+					  kx=x+jx*16+i;
+					  t=bitmap[i+jx*16+jy*64];					 
+					  for (k=0;k<8;k++) {
+					      ky=y+jy*8+k;
+					      if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor);
+						}					 
+		     }
+			}
+}
+
+void draw_LCD(unsigned char *buffer)
+{
+  uint8_t x,y;
+	for (x=0; x<LCD_Xmax; x++) {
+    	for (y=0; y<(LCD_Ymax/8); y++) {
+			   lcdSetAddr(x ,y);
+			   lcdWriteData(buffer[x+y*LCD_Xmax]);
+			}
+		}			
+}
+
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 main.cpp
--- a/main.cpp	Wed Jun 22 08:02:37 2016 +0000
+++ b/main.cpp	Tue Jun 28 11:03:39 2016 +0000
@@ -1,33 +1,31 @@
 #include "mbed.h"
 #include "I2C_SSD1306Z.h" 
 #include "BME280.h"
+#include "setwifi.h"
 
 
+RawSerial pc(USBTX, USBRX); // tx, rx 
 I2C i2c(I2C_SDA, I2C_SCL);
-BME280 sensor(PB_3, PB_10);
- 
-DigitalOut myled(LED1);
-Serial pc(SERIAL_TX, SERIAL_RX);
+I2C bme(PB_3, PB_10);
+BME280 sensor(bme, DEFAULT_SLAVE_ADDRESS); 
+ESP8266Interface wi_fi(PA_11, PA_12, D0, "ittraining402","itstudent"); // tx, rx 
 
-unsigned char BMP_Logo_ittraining[128*8] = { // IT Logo 
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF8,0xF8,0xF8,0xC0,0xC0,0xC0,0x00,0xC0,0xC0,0xC0,0xF8,0xF8,0xF8,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0x78,0x78,0x70,0xE0,0xC0,0x00,0x60,0x60,0x60,0xE0,0xE0,0x60,0x78,0x78,0x70,0x60,0x60,0xE0,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0xB0,0xB0,0x98,0x90,0x40,0xD0,0xF8,0x70,0x70,0xF0,0x58,0x10,0x00,0xB0,0xB0,0xB0,0xB0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0x70,0x70,0x70,0xF0,0xF0,0x70,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xD8,0xF8,0xF0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x61,0xF1,0xE7,0x87,0x07,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x07,0x87,0xC7,0xF1,0x61,0x21,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x83,0x87,0x8F,0x8D,0xFC,0xFC,0x8C,0x8C,0x80,0x00,0xF0,0xF0,0xF1,0x37,0x3F,0x3E,0x30,0xF0,0xF0,0x38,0x3F,0x3F,0x33,0xF0,0xF0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xFF,0xFF,0xED,0xCD,0xCD,0xCD,0xC0,0xF2,0xDB,0xDE,0xCE,0xDE,0xFF,0xD2,0xC0,0xCD,0xCD,0xCD,0xCD,0xFF,0xFF,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x10,0x7E,0xFF,0xC3,0x00,0x00,0x8F,0x8F,0x81,0xB9,0xB9,0xB9,0xB9,0xB9,0xB9,0xB9,0xB9,0x81,0x8F,0x8F,0x8F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0xBC,0xF8,0xF0,0xE0,0xF0,0xF8,0xBC,0x9E,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFD,0xF1,0x01,0xFF,0xFF,0x01,0x71,0x7D,0x0C,0x00,0xFE,0xFE,0xFE,0x06,0x06,0x06,0xFF,0xFF,0x06,0x06,0x06,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0xC7,0xC7,0xC7,0xC0,0xC0,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xF6,0xF6,0xFE,0xDE,0xDE,0xCE,0xCE,0xC6,0xC0,0xC0,0xC7,0xC7,0xC7,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x08,0x38,0x38,0x3D,0x3F,0x0F,0x00,0x03,0x83,0xC3,0xFF,0x7F,0x03,0x03,0x03,0xFF,0xFF,0x03,0x03,0x03,0xE3,0xC3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x1C,0x1C,0x0E,0x0E,0x0E,0x07,0x07,0x03,0x03,0x01,0x01,0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x0E,0x0E,0x0E,0x1C,0x1C,0x0C,0x00,0x00,0x00,0x00,0x0C,0x0D,0x0C,0x0E,0x07,0x07,0x06,0x06,0x03,0x03,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x0F,0x0F,0x00,0x03,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x0E,0x0E,0x0E,0x0E,0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00,0x00,0x04,0x0C,0x0E,0x07,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x07,0x0F,0x0E,0x0E,0x0E,0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-};
+const char* TEST_SERVER_ADDRESS = "192.168.2.65";
+const int TEST_SERVER_PORT = 8889;
+
+
 
 int main()
 {
-
+    pc.baud(115200);
     char tbuffer[50], hpbuffer[50], hbuffer[50];
-    printf("init oled\n");
-    
+    printf("init oled\r\n");
     Init_LCD();
     clear_LCD();
+    TCPSocketConnection socket;
+    
+    if((setwifi(&wi_fi)) != 0)
+        printf("wifi not connect\r\n");
  
   while (1) {
      
@@ -44,23 +42,40 @@
      print_Line(0, tbuffer);
      print_Line(1, hpbuffer);
      print_Line(2, hbuffer);
-      
- /*   print_Line(0,"%2.2f degC\r\n", (sensor.getTemperature()-32)*5.0/9.0);
-    print_Line(1, "%04.2f hPa\r\n", sensor.getPressure());
-    print_Line(2, "%2.2f %%\r\n", sensor.getHumidity());
+     
+     
+    if(socket.is_connected() != true)
+    {
+        while (socket.connect(TEST_SERVER_ADDRESS, TEST_SERVER_PORT) < 0) {
+            pc.printf("Unable to connect to (%s) on port (%d)\n", TEST_SERVER_ADDRESS, TEST_SERVER_PORT);
+            wait(1);
+        }
+    }
+    char endl[5] = " \r\n";
+    strcat(tbuffer, endl);
+    strcat(hpbuffer, endl);
+    strcat(hbuffer, endl);
+   
+   
+    socket.send_all(tbuffer, strlen(tbuffer));
+    socket.send_all(hpbuffer, strlen(hpbuffer));
+    socket.send_all(hbuffer, strlen(hbuffer));
     
-   /*  draw_LCD(BMP_Logo_ittraining);
-     wait(2.0);
-     clear_LCD();
-     print_Line(0, "IT Maker Space");
-     print_Line(1, "ARM mbed RTOS");
-     print_Line(2, "ST Micro");
-     print_Line(3, "ittraining.com");  */
-     wait(2.0);
-     clear_LCD();
+    //printf("%s%s%s", tbuffer, hpbuffer, hbuffer);
+   
+    /*char rev[1024]; 
+    socket.receive(rev, 1024);
+    printf("%s\r\n", rev);*/
+    
+    
+    
+    wait(1);
+    clear_LCD();
+    wait(0.5);
+  
 
    }
-
+      socket.close();
 }
 
 
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 mbed-src.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-src.lib	Tue Jun 28 11:03:39 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/kaizen/code/mbed-src/#d1b257119699
diff -r dcaf0bcf6df6 -r f0f39d7c1c16 mbed.bld
--- a/mbed.bld	Wed Jun 22 08:02:37 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb
\ No newline at end of file