for znrobotics workshop

Dependencies:   DHT22 HTTPClient SDFileSystem WIZnet_Library mbed

Fork of archlink_Temperture_dweetio by Kevin Lee

This program is for seeed arch link, using wiznet w550 ethernet interface. not compatible with mbed ethernet interface.

Files at this revision

API Documentation at this revision

Comitter:
Kevin_Lee
Date:
Mon Jul 06 01:55:07 2015 +0000
Parent:
3:cfc6ff08a668
Child:
5:35f80d88820f
Commit message:
upload the data to dweet.io

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jul 02 10:05:43 2015 +0000
+++ b/main.cpp	Mon Jul 06 01:55:07 2015 +0000
@@ -1,3 +1,4 @@
+/* This is just a demo by Kevin Lee */
 #include "mbed.h"
 #include "SDFileSystem.h"
 #include "BLE.h"
@@ -5,7 +6,6 @@
 #include "HTTPClient.h"
 #include "DHT.h"
 
-#define DHT22_Test 0
 
 #define USE_DHCP 0
 #define LOOPBACKPORT  5000
@@ -36,29 +36,7 @@
     wait(1);
     pc.baud(115200);
     wait(1);
-    printf("helloworld\r\n");
-    
-    /*
-    float resistance = (float)(1023.0-val)*10000.0/(float)val;
-    float temp = 1/(log(resistance/10000)/B+1/298.15)-273.15;
-    */
-    
-#if DHT22_Test 
-    int result;
-    while(1) {
-        printf("dht22.readData()\r\n");
-        printf("ain A0: %.2f\r\n",ain.read());
-        printf("temperature_get %.2f\r\n",temperature_get());
-        result = dht22.readData();
-        printf("the result is %d.\r\n",result);
-        if(result == 0) {
-            printf("Temperature is %f.2 C\r\n",dht22.ReadTemperature(CELCIUS));
-            printf("Humidity is %f.2 \%\r\n",dht22.ReadHumidity());
-        }
-        wait(4);
-    }
-#endif   
-    
+    printf("helloworld\r\n");  
     
     if(W5500_Test() == 0) {                  // Internet is ok
         printf("W5500 tested OK \r\n");
@@ -133,31 +111,15 @@
         //exit(0);
         return -1;
     }
-    /*
-    TCPSocketServer server;
-    server.bind(LOOPBACKPORT);
-    server.listen();
-    
-    while (1) {
-        pc.printf("\nWait for new connection...\r\n");
-        TCPSocketConnection client;
-        server.accept(client);
-        client.set_blocking(false, 0); // Timeout=0.
-        pc.printf("Connection from: %s\r\n", client.get_address());
-        while (client.is_connected() == true) {
-            int n = client.receive(buffer, sizeof(buffer));
-            if(n > 0)
-                client.send_all(buffer, n);
-            if(client.is_fin_received())
-                client.close();
-        }
-        pc.printf("Disconnected.\r\n");
-    }*/
 }
 
 
 float temperature_get()
 {
+    /*
+    float resistance = (float)(1023.0-val)*10000.0/(float)val;
+    float temp = 1/(log(resistance/10000)/B+1/298.15)-273.15;
+    */ 
     int B = 3975;
     float val = (ain.read()*1023);
     float resistance = (float)(1023.0-val)*10000.0/(float)val;