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.
Dependencies: DHT WIZnetInterface mbed-src
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 #include "DHT.h" 00004 00005 #include "TCPSocketConnectionArdu.h" 00006 #include "ThingerMBedEthernet.h" 00007 #include "ThingerMBedClient.h" 00008 00009 00010 /* ThingerIO Define */ 00011 #define USERNAME "MidnightCow" 00012 #define DEVICE_ID "WIZwiki_W7500_mbed_01" 00013 #define DEVICE_CREDENTIAL "Your Access Key" 00014 00015 /* YUROBOT SHILED1 PIN Define*/ 00016 #define myLED1 D13 00017 #define myLED2 D12 00018 00019 #define myRLED D9 00020 #define myGLED D10 00021 #define myBLED D11 00022 00023 #define myBUZZ D5 00024 00025 #define myTEMPHUMM D4 00026 00027 #define myLIGHT A1 00028 00029 //using namespace std; 00030 DigitalOut myled1(myLED1); 00031 DigitalOut myled2(myLED2); 00032 00033 DigitalOut myrled(myRLED); 00034 DigitalOut mygled(myGLED); 00035 DigitalOut mybled(myBLED); 00036 DigitalOut myBuzz(myBUZZ); 00037 00038 AnalogIn mylight(myLIGHT); 00039 00040 DHT myTempHumm(myTEMPHUMM, DHT11); 00041 00042 00043 00044 void my_led1(pson& in) 00045 { 00046 myled1 = (in) ? 1 : 0; 00047 } 00048 00049 void my_led2(pson& in) 00050 { 00051 myled2 = (in) ? 1 : 0; 00052 } 00053 00054 void my_TempHumm(pson& out) 00055 { 00056 if(myTempHumm.readData() == 0) 00057 { 00058 out["Cecelcius"] = myTempHumm.ReadTemperature(CELCIUS); 00059 out["Humidity"] = myTempHumm.ReadHumidity(); 00060 } 00061 else 00062 { 00063 out["Cecelcius"] = 65535; 00064 out["Humidity"] = 65535; 00065 } 00066 } 00067 00068 /* 00069 void my_rgbled(pson& in) 00070 { 00071 myrled = (in["Red"]) ? 1 : 0; 00072 mygled = (in["Green"]) ? 1 : 0; 00073 mybled = (in["Blue"]) ? 1 : 0; 00074 } 00075 */ 00076 00077 00078 int main() { 00079 00080 EthernetInterface eth; 00081 00082 ThingerEthernet thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); 00083 00084 myled1 = 1; 00085 myled2 = 1; 00086 00087 // resource input example (i.e. turning on/off a light, a relay, configuring a parameter, etc) 00088 thing["myled1"] << my_led1; 00089 thing["myled2"] << my_led2; 00090 thing["mySensor"] >> my_TempHumm; 00091 //thing["myRGB"] << my_rgbled; 00092 00093 while(1) 00094 { 00095 thing.handle(); 00096 } 00097 }
Generated on Wed Jul 13 2022 02:25:39 by
