Adafruit i2c SHT40 example

Dependencies:   SHT40

Files at this revision

API Documentation at this revision

Comitter:
reedas
Date:
Mon Feb 07 15:12:28 2022 +0000
Commit message:
Example project using SHT40 basic library

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
CONTRIBUTING.md Show annotated file Show diff for this revision Revisions of this file
README.md Show annotated file Show diff for this revision Revisions of this file
SHT40.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-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
resources/official_armmbed_example_badge.png Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CONTRIBUTING.md	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,5 @@
+# Contributing to Mbed OS
+
+Mbed OS is an open-source, device software platform for the Internet of Things. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor.
+
+To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/mbed-os/latest/contributing/index.html).
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,15 @@
+# SHT40 i2c temperature and humidity example
+
+This project is a basic driver for the sht40 i2c proto board from adafruit
+
+The code has been created with reference to the Arduino ide version published
+by Adafruit.
+
+Put together by a hardware engineer who understands little of the intricacies 
+of cpp programming an so the library is ripe for improvement by someone that
+does.
+
+No guarantee of fitness for purpose, use at your own risk.  Released under 
+a freeware license, pleases support by buying stuff from Adafruit
+
+Andrew Reed mailto://areed@cityplym.ac.uk
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SHT40.lib	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/reedas/code/SHT40/#c46b3e0a8c2b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,47 @@
+/** Sample program to read temperature and humidity
+ *
+ * @author Alex Lipford
+ * Georgia Institute of Technology 
+ * ECE 4180 Embeded Systems Design
+ * Professor Hamblen
+ * 10/19/2014
+ * 
+ * @section LICENSE
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <alexlipford@gmail.com> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return.
+ * ----------------------------------------------------------------------------
+ *
+ *
+ * @section DESCRIPTION
+ *
+ * Honeywell HTU21D Humidity and Temperature sensor.
+ *
+ * Datasheet, specs, and information:
+ *
+ * https://www.sparkfun.com/products/12064
+ */
+ 
+#include "mbed.h"
+#include "SHT40.h"
+#include "platform/mbed_thread.h"
+
+SHT40 temphumid(P6_1, P6_0); //Temp humid sensor || SDA, SCL
+
+int tempC;
+int relHumid;
+
+int main() {
+    printf("Starting humidity and temperature Sensor");
+    while(1) {
+        tempC = temphumid.tempC();
+        thread_sleep_for(1000);
+        relHumid = temphumid.relHumid();
+        printf("Temperature: %d C\n\r", tempC);
+        printf("Reative Humidity: %d %%\n\r", relHumid);
+        printf("\n\r");
+        thread_sleep_for(1000);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Mon Feb 07 15:12:28 2022 +0000
@@ -0,0 +1,8 @@
+{
+    "target_overrides": {
+        "*": {
+            "platform.stdio-convert-newlines": true,
+            "platform.stdio-baud-rate": 115200
+        }
+    }
+}
\ No newline at end of file
Binary file resources/official_armmbed_example_badge.png has changed