Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "ESP8266Interface.h" 00003 #include "TCPSocketConnection.h" 00004 #include "ifttt.h" 00005 #include "SoftSerialSendOnry.h" 00006 #include "DHT.h" 00007 00008 DHT sensor(dp13, DHT11); 00009 00010 ESP8266Interface wifi(dp16,dp15,dp4,"SSID","Password",115200); // TX,RX,Reset,SSID,Password,Baud 00011 00012 SoftSerialSendOnry pc(dp10); // tx 00013 00014 int main() 00015 { 00016 int error = 0; 00017 float h = 0.0f, c = 0.0f; 00018 00019 pc.baud(9600); 00020 wifi.init(); //Reset 00021 wifi.connect(); //Use DHCP 00022 pc.printf("IP Address is %s \n\r", wifi.getIPAddress()); 00023 TCPSocketConnection socket; 00024 00025 error = sensor.readData(); 00026 if (0 == error) { 00027 00028 c = sensor.ReadTemperature(CELCIUS); 00029 h = sensor.ReadHumidity(); 00030 00031 // Initialize ifttt object, add up to 3 optional values, trigger event. 00032 IFTTT ifttt("EventName","Secret Key", &socket); // EventName, Secret Key, socket to use 00033 00034 char tmp1[16],tmp2[16]; 00035 00036 sprintf(tmp1,"%4.2f",c); 00037 sprintf(tmp2,"%4.2f",h); 00038 00039 ifttt.addIngredients(tmp1,tmp2,"value3"); 00040 ifttt.trigger(IFTTT_POST); 00041 00042 } else { 00043 pc.printf("Error: %d\n", error); 00044 } 00045 }
Generated on Wed Jul 13 2022 05:04:33 by
1.7.2