Program to read temperature and humidity over I2C from the GE ChipCap2 sensor, using the MBED LPC11U24 board. !!! NOT WORKING !!! This reference program for Arduino DO work: http://hastebin.com/tilolukave.go If you locate the error please let me know at mario@baldini.systems

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mbn12
Date:
Fri Aug 08 01:03:08 2014 +0000
Child:
1:7008e7b00996
Commit message:
Program to read temperature and humidity over I2C; from the GE ChipCap2 sensor, using the MBED LPC11U24 board.; ; !!! NOT WORKING !!!; This reference program for Arduino DO work: http://hastebin.com/tilolukave.go

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Aug 08 01:03:08 2014 +0000
@@ -0,0 +1,103 @@
+/*
+
+Program to read temperature and humidity over I2C
+from the GE ChipCap2 sensor, using the MBED LPC11U24 board.
+
+Autor: Mario Baldini <mario@baldini.systems>
+2014/08
+
+!!! NOT WORKING !!!
+This reference program for Arduino DO work: http://hastebin.com/tilolukave.go
+
+If you locate the error in this mbed version, 
+please e-mail me at mario@baldini.systems
+
+Reading the output (in linux): sudo screen /dev/ttyACM0 115200
+
+
+*/
+
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+I2C i2c(p28,p27);   //sda,scl
+
+
+int main() {
+    pc.baud(115200);
+    pc.printf("begin\r\n");
+
+    int address = 0x28;
+    char data[4];
+    data[0] = 0x00;   
+    data[1] = 0x00;
+    data[2] = 0x00;
+    data[3] = 0x00;
+    
+    char data_write[3];
+    data_write[0] = 0xA0;
+    data_write[1] = 0x00;
+    data_write[2] = 0x00;
+    
+    
+    i2c.frequency(400000);
+
+
+    while(true) {
+        pc.printf("loop()\r\n");
+        data[0] = 0x00;   
+        data[1] = 0x00;
+        data[2] = 0x00;
+        data[3] = 0x00;
+    
+        
+        //  TRY 1      
+        i2c.start();
+        i2c.write(address, data_write, 3);
+        wait_ms(50);
+        i2c.stop();
+        
+        i2c.start();
+        i2c.read(address, data, 4);
+        i2c.stop();
+        
+        pc.printf("Ver.1 Data[]\t 0x%X   0x%X   0x%X   0x%X \r\n\n", data[0],data[1],data[2],data[3]);
+        
+        
+        
+        
+        // TRY 2
+        i2c.start();
+        i2c.write(0xA0);
+        i2c.write(0x00);
+        i2c.write(0x00);
+        i2c.stop();
+        wait_ms(50);
+        
+        i2c.start();
+        i2c.read(address, data, 4);
+        i2c.stop();
+        pc.printf("Ver.2 Data[]\t 0x%X   0x%X   0x%X   0x%X \r\n\n", data[0],data[1],data[2],data[3]);
+        
+
+
+        // TRY 3
+        i2c.write(address, data_write, 3);
+        i2c.write(0xA0);
+        i2c.write(0x00);
+        i2c.write(0x00);
+        wait_ms(50);
+        
+        
+        i2c.read(address, data, 4);
+        data[0] = i2c.read(0x01);
+        data[1] = i2c.read(0x01);
+        data[2] = i2c.read(0x00);
+        data[3] = i2c.read(0x00);
+        pc.printf("Ver.3 Data[]\t 0x%X   0x%X   0x%X   0x%X \r\n\n", data[0],data[1],data[2],data[3]);
+
+        
+        
+        wait_ms(2000);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Aug 08 01:03:08 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804
\ No newline at end of file