Simple example that reads temperature and humidity from Si7006-A20 chip over i2c.

Dependencies:   Si7006A20 aconno_I2C adc52832_common mbed

Files at this revision

API Documentation at this revision

Comitter:
jurica238814
Date:
Mon Sep 25 10:22:28 2017 +0000
Commit message:
Temperature and humidity reading work.

Changed in this revision

Si7006A20.lib Show annotated file Show diff for this revision Revisions of this file
aconno_I2C.lib Show annotated file Show diff for this revision Revisions of this file
aconno_nrf52_uart.lib Show annotated file Show diff for this revision Revisions of this file
adc52832_common.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r c8fa7e8568c6 Si7006A20.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Si7006A20.lib	Mon Sep 25 10:22:28 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/jurica238814/code/Si7006A20/#155934570c14
diff -r 000000000000 -r c8fa7e8568c6 aconno_I2C.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/aconno_I2C.lib	Mon Sep 25 10:22:28 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/jurica238814/code/aconno_I2C/#5ae1807e3902
diff -r 000000000000 -r c8fa7e8568c6 aconno_nrf52_uart.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/aconno_nrf52_uart.lib	Mon Sep 25 10:22:28 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Dautor/code/aconno_nrf52_uart/#6fb6225f7853
diff -r 000000000000 -r c8fa7e8568c6 adc52832_common.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adc52832_common.lib	Mon Sep 25 10:22:28 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/aconno-dev-team/code/adc52832_common/#b694bfd63c68
diff -r 000000000000 -r c8fa7e8568c6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 25 10:22:28 2017 +0000
@@ -0,0 +1,43 @@
+/*
+ * Made by Jurica @ aconno
+ * jurica_resetar@yahoo.com
+ *
+*/
+
+#include <stdio.h>
+#include "mbed.h"
+#include "Si7006A20.h"
+#include "nrf52_digital.h"
+
+#define DEBUG_PRINT     (1)
+
+#if DEBUG_PRINT
+    #include "nrf52_uart.h"
+    #define TX_PIN_NUMBER p25
+    #define RX_PIN_NUMBER p26
+    NRF52_UART serial(TX_PIN_NUMBER, RX_PIN_NUMBER, Baud9600);
+    char buffer[255]={0};
+    #define SEND(...) {uint8_t len = sprintf(buffer, __VA_ARGS__); serial.send(buffer, len);}
+#else
+    #define SEND(...);
+#endif
+
+Si7006 si(p19, p20);
+NRF52_DigitalOut power(p2);
+
+int main(){    
+    float temperature;  
+    float humidity;
+    
+    SEND("Main started.\r\n");
+    power = 1;
+    SEND("Main power activated.\r\n");
+    
+    while(1){
+        humidity = si.getHumidity();
+        SEND("Humidity is: %f%%\r\n", humidity);
+        temperature = si.getTemperature();
+        SEND("Temperature is: %fC\r\n", temperature);
+        wait(1);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r c8fa7e8568c6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Sep 25 10:22:28 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/0f02307a0877
\ No newline at end of file