Hackathon

Dependencies:   C12832 CCS811 MMA7660 Sht31 TSL2561

Fork of Mbed-Connect-Cloud-Demo by Cambridge Hackathon

Files at this revision

API Documentation at this revision

Comitter:
Jenny Plunkett
Date:
Thu Nov 09 12:29:25 2017 -0600
Child:
1:6791f0504ab0
Commit message:
Blank program for tutorial (with working)

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
CCS811.lib Show annotated file Show diff for this revision Revisions of this file
MMA7660.lib Show annotated file Show diff for this revision Revisions of this file
Sht31.lib Show annotated file Show diff for this revision Revisions of this file
TSL2561.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_settings.py Show annotated file Show diff for this revision Revisions of this file
working/main_working.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CCS811.lib	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/andcor02/code/CCS811/#64a96d555ef0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA7660.lib	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,1 @@
+https://mbed.org/users/Sissors/code/MMA7660/#36a163511e34
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sht31.lib	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/andcor02/code/Sht31/#c84a60326ecf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSL2561.lib	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/andcor02/code/TSL2561/#8146a28a20cc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,32 @@
+//----------------------------------------------------------------------------
+// The confidential and proprietary information contained in this file may
+// only be used by a person authorised under and to the extent permitted
+// by a subsisting licensing agreement from ARM Limited or its affiliates.
+//
+// (C) COPYRIGHT 2016 ARM Limited or its affiliates.
+// ALL RIGHTS RESERVED
+//
+// This entire notice must be reproduced on all copies of this file
+// and copies of this file may only be made by a person if such person is
+// permitted to do so under the terms of a subsisting license agreement
+// from ARM Limited or its affiliates.
+//----------------------------------------------------------------------------
+#include "mbed.h"
+#include "C12832.h"
+#include "CCS811.h"
+#include "Sht31.h"
+#include "TSL2561.h"
+#include "MMA7660.h"
+
+// GLOBAL VARIABLES HERE
+
+
+// FUNCTION DEFINTIONS HERE
+
+
+int main() {
+
+    // MAIN CODE HERE
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#0d1dc83eb1f2d24e7ef9bedf373e50c1784d2e2f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_settings.py	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,45 @@
+"""
+mbed SDK
+Copyright (c) 2016 ARM Limited
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from os.path import join, abspath, dirname
+
+#ROOT = abspath(join(dirname(__file__), "."))
+
+##############################################################################
+# Build System Settings
+##############################################################################
+#BUILD_DIR = abspath(join(ROOT, "build"))
+
+# ARM
+#ARM_PATH = "C:/Program Files/ARM"
+
+# GCC ARM
+#GCC_ARM_PATH = ""
+
+# GCC CodeRed
+#GCC_CR_PATH = "C:/code_red/RedSuite_4.2.0_349/redsuite/Tools/bin"
+
+# IAR
+#IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm"
+
+# Goanna static analyser. Please overload it in private_settings.py
+#GOANNA_PATH = "c:/Program Files (x86)/RedLizards/Goanna Central 3.2.3/bin"
+
+#BUILD_OPTIONS = []
+
+# mbed.org username
+#MBED_ORG_USER = ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/working/main_working.h	Thu Nov 09 12:29:25 2017 -0600
@@ -0,0 +1,98 @@
+//----------------------------------------------------------------------------
+// The confidential and proprietary information contained in this file may
+// only be used by a person authorised under and to the extent permitted
+// by a subsisting licensing agreement from ARM Limited or its affiliates.
+//
+// (C) COPYRIGHT 2016 ARM Limited or its affiliates.
+// ALL RIGHTS RESERVED
+//
+// This entire notice must be reproduced on all copies of this file
+// and copies of this file may only be made by a person if such person is
+// permitted to do so under the terms of a subsisting license agreement
+// from ARM Limited or its affiliates.
+//----------------------------------------------------------------------------
+#include "mbed.h"
+#include "C12832.h"
+#include "CCS811.h"
+#include "Sht31.h"
+#include "TSL2561.h"
+#include "MMA7660.h"
+
+// GLOBAL VARIABLES HERE
+
+C12832  lcd(PE_14, PE_12, PD_12, PD_11, PE_9);
+Sht31   temp_sensor(PF_0, PF_1);
+DigitalOut  led(PB_8, 1);
+InterruptIn button(PF_2);
+CCS811  air_sensor(PF_0, PF_1);
+TSL2561 light_sensor(PF_0, PF_1, TSL2561_ADDR_HIGH);
+MMA7660 accel(PF_0, PF_1);
+
+// FUNCTION DEFINTIONS HERE
+
+void lcd_print(const char* message) {
+    lcd.cls();
+    lcd.locate(0, 3);
+    lcd.printf(message);
+}
+
+void toggle_led() {
+    led = !led;
+}
+
+void read_temp() {
+    float t = temp_sensor.readTemperature();
+    float h = temp_sensor.readHumidity();
+    char val[32];
+    sprintf(val, "TEMP: %3.2fC, HUM: %3.2f%%", t, h);
+    lcd_print(val);
+}
+
+void read_air() {
+    air_sensor.init();
+    uint16_t eco2, tvoc;
+    air_sensor.readData(&eco2, &tvoc);
+    char val[32];
+    sprintf(val, "eCO2: %dppm, TVOC : %dppb", eco2, tvoc);
+    lcd_print(val);
+}
+
+void read_light() {
+    int vis = light_sensor.getLuminosity(TSL2561_VISIBLE);
+    int infr = light_sensor.getLuminosity(TSL2561_INFRARED);
+    char val[32];
+    sprintf(val, "VIS: %d, INFR: %d ", vis, infr);
+    lcd_print(val);
+}
+
+void read_accel() {
+    float x = accel.x();
+    float y = accel.y();
+    float z = accel.z();
+    char val[32];
+    sprintf(val, "x=%.2f y=%.2f z=%.2f", x, y, z);
+    lcd_print(val);
+}
+
+int main() {
+
+    // MAIN CODE HERE
+    lcd_print("Hello World!");
+    button.rise(&toggle_led);
+    light_sensor.begin();
+    light_sensor.setGain(TSL2561_GAIN_0X);
+    light_sensor.setTiming(TSL2561_INTEGRATIONTIME_402MS);
+
+    while(1) {
+        // WHILE LOOP CODE HERE
+        read_temp();
+        wait_ms(2000);
+        read_air();
+        wait_ms(2000);
+        read_light();
+        wait_ms(2000);
+        read_accel();
+        wait_ms(2000);
+    }
+
+}