This is a test program for the eee@ncl project

Dependencies:   mbed SHT21_ncleee

Files at this revision

API Documentation at this revision

Comitter:
graeme88
Date:
Thu Dec 06 10:38:37 2012 +0000
Parent:
1:9d26ddb57191
Commit message:
updated test program for ncl eee space project

Changed in this revision

SHT21_ncleee.lib 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
diff -r 9d26ddb57191 -r b7ce3ec3d45d SHT21_ncleee.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SHT21_ncleee.lib	Thu Dec 06 10:38:37 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/graeme88/code/SHT21_ncleee/#03bbabb7b0b0
diff -r 9d26ddb57191 -r b7ce3ec3d45d main.cpp
--- a/main.cpp	Thu Nov 29 15:54:53 2012 +0000
+++ b/main.cpp	Thu Dec 06 10:38:37 2012 +0000
@@ -1,17 +1,31 @@
-#include "mbed.h"
-
-DigitalOut myled(LED1);
-Serial pc(USBTX, USBRX);
-
-int main() {
-
-    while(1)                        //loop forever
-    {   
-        for(int i=0; i<10; i++)     //count from 0 to 9
-        {
-            myled = !myled;         //toggle LED
-            pc.printf("%d\n",i);      //send a character to the PC, PC will see '0' in Ascii which is equal to 48 in dec, 30 in hex
-            wait(1.0);                
-        }
-    }
-}
+#include "mbed.h"
+#include "SHT21_ncleee.h"
+
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+I2C i2c(p28,p27);
+SHT21 sht(&i2c);
+
+
+int main() {
+
+    pc.printf("Hello World...\n Testing temperature and humidity sensor\n");
+    
+    float temperature;
+    float humidity;
+   
+
+    while(1) {
+        temperature = sht.readTemp();
+        humidity = sht.readHumidity();
+       
+        
+        pc.printf("Temperature=%.1f%cC Humidity=%.1f%%\n",temperature,248,humidity);
+    
+        myled = 1;
+        wait(2.5);
+        myled = 0;
+        wait(2.5);
+    }
+}