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.
Revision 0:5e155faa10f0, committed 2015-04-17
- Comitter:
- kgills
- Date:
- Fri Apr 17 15:55:06 2015 +0000
- Commit message:
- Creating example code for Si7020
Changed in this revision
| Si7020.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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Si7020.lib Fri Apr 17 15:55:06 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/kgills/code/Si7020/#9a1febb56203
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Apr 17 15:55:06 2015 +0000
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include "mbed.h"
+#include "Si7020.h"
+
+I2C i2c(I2C_SDA, I2C_SCL);
+Si7020 si(&i2c);
+
+int main()
+{
+ while(1) {
+
+ float humid;
+ if(si.getHumidity(&humid) != 0) {
+ printf("Error getting humidity\n");
+ humid = -1;
+ }
+
+ float temp;
+ if(si.getTemperature(&temp) != 0) {
+ printf("Error getting temperature");
+ temp = -1;
+ }
+ printf("Humidity = %f%% Temperature = %fC\n", humid, temp);
+
+ wait(1);
+ }
+}
\ No newline at end of file
Si7020 | Humidity and Temperature Sensor