mbed device for IPSO Interop 2015

Dependencies:   Chainable_RGB_LED DHT LED_Bar mbed mbedConnectorInterface mbedEndpointNetwork_mjk_regfix

Files at this revision

API Documentation at this revision

Comitter:
michaeljkoster
Date:
Tue May 19 21:34:25 2015 +0000
Commit message:
initial commit

Changed in this revision

Chainable_RGB_LED.lib Show annotated file Show diff for this revision Revisions of this file
DHT.lib Show annotated file Show diff for this revision Revisions of this file
LED_Bar.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
mbedConnectorInterface.lib Show annotated file Show diff for this revision Revisions of this file
mbedEndpointNetwork.lib Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/ButtonResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/BuzzerResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/DHT11.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/DHT11_HumiResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/DHT11_TempResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/IlluminanceResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/LedBarResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/LightResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/LoudnessResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/LuminanceResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/OnBoardLED.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/PresenceResource.h Show annotated file Show diff for this revision Revisions of this file
mbedEndpointResources/TempResource.h Show annotated file Show diff for this revision Revisions of this file
nsp_configuration.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r f299ce844c09 Chainable_RGB_LED.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Chainable_RGB_LED.lib	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/seeed/code/Chainable_RGB_LED/#50d0a66599e1
diff -r 000000000000 -r f299ce844c09 DHT.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT.lib	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/components/code/DHT/#df22ddf10d75
diff -r 000000000000 -r f299ce844c09 LED_Bar.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LED_Bar.lib	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Seeed/code/LED_Bar/#edcb13b58b4f
diff -r 000000000000 -r f299ce844c09 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,164 @@
+/**
+ * @file    main.cpp
+ * @brief   mbed Connected Home Endpoint main entry point
+ * @author  Doug Anson
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2014
+ *
+ * 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.
+ */
+
+// mbed Connector Interface (configuration)
+#include "mbedConnectorInterface.h"
+
+// mbed Connector Endpoint includes
+#include "ConnectorEndpoint.h"
+#include "OptionsBuilder.h"
+
+// USB Serial port access for debugging/logging
+RawSerial pc(USBTX,USBRX);
+
+// Logging facility
+Logger logger(&pc);
+
+// Static Resources
+#include "StaticResource.h"
+StaticResource mfg(&logger,"3/0/0","ARM-mbed");
+StaticResource model(&logger,"3/0/1","mbed-6LoWPAN-demo");
+
+//
+// Dynamic Resource Note:
+//
+//  mbedConnectorInterface supports up to IPT_MAX_ENTRIES 
+//  (currently 5) independent dynamic resources.
+//
+//  You can increase this (at the cost of memory) 
+//  in mbedConnectorinterface.h
+//
+
+// Light Resource
+#include "LightResource.h"
+//LightResource light(&logger,"3311/0/5706");
+
+// LED Resource
+#include "OnBoardLED.h"
+LEDResource led(&logger,"3311/1/5706");
+
+// Temperature Resource
+#include "TempResource.h"
+//TempResource temp(&logger,"3303/0/5700", true); /* true if observable */
+
+// DHT11 Temperature Resource
+#include "DHT11_TempResource.h"
+//DHT11_TempResource dht_temp(&logger,"3303/0/5700", false); /* true if observable */
+
+// DHT11 Humidity  Resource
+#include "DHT11_HumiResource.h"
+//DHT11_HumiResource dht_humi(&logger,"3304/0/5700", true); /* true if observable */
+
+// Illuminance Resource
+#include "IlluminanceResource.h"
+//IlluminanceResource illum(&logger,"3301/0/5700", true); /* true if observable */
+
+// LedBar Resource
+#include "LedBarResource.h"
+//LedBarResource ledbar(&logger,"3306/0/5853", false); /* true if observable */
+
+// Button Resource
+#include "ButtonResource.h"
+ButtonResource button(&logger,"3200/0/5500", true); /* true if observable */
+
+// Buzzer Resource
+#include "BuzzerResource.h"
+//BuzzerResource buzzer(&logger,"3201/0/5500", false); /* true if observable */
+
+// Loudness Resource
+#include "LoudnessResource.h"
+LoudnessResource loud(&logger,"3324/0/5700", true); /* true if observable */
+
+// Luminance Resource
+#include "LuminanceResource.h"
+LuminanceResource lumi(&logger,"3300/0/5700", true); /* true if observable */
+
+// Presence Resource
+#include "PresenceResource.h"
+PresenceResource pres(&logger,"3302/0/5700", true); /* true if observable */
+
+
+
+// Set our own unique endpoint name
+#define MY_ENDPOINT_NAME                       "mbed1"
+
+// My NSP Domain
+#define MY_NSP_DOMAIN                          "domain"                               
+
+// Customization Example: My custom NSP IPv4 or IPv6 address and NSP CoAP port 
+//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {0x20,0x02,0x0d,0xb4,0x00,0x00,0x00,0x00,0x02,0x0c,0x43,0xff,0xfe,0x87,0x81,0x7c}; 
+uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {0x20,0x02,0x0d,0xb4,0x00,0x00,0x00,0x00,0xba,0x27,0xeb,0xff,0xfe,0xc6,0x35,0x38}; 
+int my_nsp_coap_port                          = 5683;
+
+// called from the Endpoint::start() below to create resources and the endpoint internals...
+Connector::Options *configure_endpoint(Connector::OptionsBuilder &config)
+{
+    // Build the endpoint configuration parameters
+    logger.log("configure_endpoint: building endpoint configuration...");
+//    temp.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+    button.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+//    DHT_temp.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+//    DHT_humi.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+//    illum.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+    lumi.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+    pres.setMaxAge(0); /* MaxAge = 0 to disable caching of the value in the Device Server */
+ 
+    return config.setEndpointNodename(MY_ENDPOINT_NAME)                   // custom endpoint name
+                 .setNSPAddress(my_nsp_address)                           // custom NSP address
+                 .setDomain(MY_NSP_DOMAIN)                                // custom NSP domain
+                 .setNSPPortNumber(my_nsp_coap_port)                      // custom NSP CoAP port
+                 
+                 // add the static resource representing this endpoint
+                 .addResource(&mfg)
+                 .addResource(&model)
+                                    
+                 // Add my specific physical dynamic resources...
+//                 .addResource(&light)
+//                 .addResource(&temp, 1000)
+                 .addResource(&led)
+//                 .addResource(&illum, 1000)
+                 .addResource(&lumi, 1000)
+//                 .addResource(&dht_temp)
+//                 .addResource(&dht_humi)
+//                 .addResource(&ledbar)
+                 .addResource(&button, 1000)
+//                 .addResource(&buzzer)
+                 .addResource(&loud, 1000)
+                 .addResource(&pres, 1000)
+                   
+                 // finalize the configuration...
+                 .build();
+}
+
+// main entry point...
+int main()
+{
+    // Announce
+    logger.log("\r\n\r\nmbed mDS Sample Endpoint v1.0 (6LoWPAN)");
+
+    // we have to plumb our network first
+    Connector::Endpoint::plumbNetwork();
+     
+    // starts the endpoint by finalizing its configuration (configure_endpoint() above called),creating a Thread and reading NSP events...
+    logger.log("Start the endpoint to finish setup and enter the main loop...");
+    Connector::Endpoint::start();
+}
diff -r 000000000000 -r f299ce844c09 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/dbbf35b96557
\ No newline at end of file
diff -r 000000000000 -r f299ce844c09 mbedConnectorInterface.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedConnectorInterface.lib	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/ansond/code/mbedConnectorInterface/#aaf84e56c422
diff -r 000000000000 -r f299ce844c09 mbedEndpointNetwork.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointNetwork.lib	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/MBED_DEMOS/code/mbedEndpointNetwork_mjk_regfix/#b2aa721e8405
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/ButtonResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/ButtonResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,59 @@
+/**
+ * @file    ButtonResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __BUTTON_RESOURCE_H__
+#define __BUTTON_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+// Push Button connected to D3
+DigitalIn button_in(D3);
+
+/** ButtonResource class
+ */
+class ButtonResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    ButtonResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"urn:X-ipso:digital-input", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Button 
+    @returns string containing 1 for button depressed or 0 for button not depressed
+    */
+    virtual string get() {
+        if(button_in.read())
+            return("1");
+        else
+            return("0");
+    }
+};
+
+#endif // __BUTTON_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/BuzzerResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/BuzzerResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,75 @@
+/**
+ * @file    BuzzerResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Doug Anson, Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2014
+ *
+ * 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.
+ */
+
+#ifndef __BUZZER_RESOURCE_H__
+#define __BUZZER_RESOURCE_H__
+
+
+// Base class
+#include "DynamicResource.h"
+
+// our buzzer
+DigitalOut buzzer_out(D4);
+
+bool buzzing = 0;
+
+/** BuzzerResource class
+ */
+class BuzzerResource : public DynamicResource
+{
+
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the Light resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    BuzzerResource(const Logger *logger,const char *name,const bool observable = false) : 
+    DynamicResource(logger,name,"urn:X-IPSO:digital-output",SN_GRS_GET_ALLOWED|SN_GRS_PUT_ALLOWED,observable) {
+    }
+    /**
+    Get the on/off value of buzzer
+    @returns string containing the last setting
+    */
+    virtual string get() {
+        if(buzzing) return ("1");
+        else return ("0");
+    }
+
+    /**
+    Set the value of the buzzer
+    @param string input 0 for quiet, 1 for buzz
+    */
+    virtual void put(const string value) {
+        if (value == "1") {
+            buzzing = 1;
+            buzzer_out = 1;
+        }
+        else if (value == "0"){
+            buzzing = 0;
+            buzzer_out = 0;
+        }
+    }
+};
+
+#endif // __BUZZER_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/DHT11.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/DHT11.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,9 @@
+#ifndef __DHT11_H__
+#define __DHT11_H__
+ 
+#include "mbed.h"
+#include "DHT.h"
+ 
+DHT DHT_sensor(D6, DHT11);
+ 
+#endif
\ No newline at end of file
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/DHT11_HumiResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/DHT11_HumiResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,59 @@
+/**
+ * @file    DhtTempResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __DHT_HUMI_RESOURCE_H__
+#define __DHT_HUMI_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+#include "DHT11.h"
+
+/** DhtTempResource class
+ */
+class DhtHumiResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    DhtHumiResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"urn:X-ipso:humidity", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Humidity Sensor
+    @returns string containing the humidity value
+    */
+    virtual string get() {
+        char humi_str[6];
+        memset(humi_str,0,6);
+        float humidity = DHT_sensor.ReadHumidity();;
+        sprintf(humi_str,"%5.2f", humidity);
+        return string(humi_str);
+    }
+};
+
+#endif // __DHT_HUMI_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/DHT11_TempResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/DHT11_TempResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,59 @@
+/**
+ * @file    DhtTempResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __DHT_TEMP_RESOURCE_H__
+#define __DHT_TEMP_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+#include "DHT11.h"
+
+/** DhtTempResource class
+ */
+class DhtTempResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    DhtTempResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"urn:X-ipso:temperature", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Temperature Sensor
+    @returns string containing the temperature value in Fahrenheit
+    */
+    virtual string get() {
+        char temp_str[6];
+        memset(temp_str,0,6);
+        float temp_f = DHT_sensor.ReadTemperature(FARENHEIT);
+        sprintf(temp_str,"%5.2f", temp_f);
+        return string(temp_str);
+    }
+};
+
+#endif // __DHT_TEMP_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/IlluminanceResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/IlluminanceResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,60 @@
+/**
+ * @file    IlluminanceResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __ILLUMI_RESOURCE_H__
+#define __ILLUMI_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+// Luminance Sensor connected to A0
+AnalogIn illumi_in(A0);
+
+/** LuminanceResource class
+ */
+class IlluminanceResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    IlluminanceResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"urn:X-ipso:illuminance", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the illuminance Sensor
+    @returns string containing the illuminance value 
+    */
+    virtual string get() {
+        char illumi_str[6];
+        memset(illumi_str,0,6);
+        float illumi_read = illumi_in.read();
+        sprintf(illumi_str,"%6.1f", (illumi_read * 100) );
+        return string(illumi_str);
+    }
+};
+
+#endif // __ILLUMI_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/LedBarResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/LedBarResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,85 @@
+/**
+ * @file    LedBarResource.h
+ * @brief   mbed CoAP Endpoint Light resource supporting CoAP GET and PUT
+ * @author  Doug Anson, Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2014
+ *
+ * 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.
+ */
+
+#ifndef __LEDBAR_RESOURCE_H__
+#define __LEDBAR_RESOURCE_H__
+
+
+// Base class
+#include "DynamicResource.h"
+
+// our LED Bar
+#include "LED_Bar.h"
+
+LED_Bar bar(D3, D2);
+
+static char * leds = {"0000000000"}; //GGGGGGGGYR
+
+
+void set_leds(char *leds)
+{
+int i;
+    for (i=0; i<=9; i++) {
+        if(leds[i] == '1')
+            bar.setSingleLed((9-i),1);
+        else if(leds[i] == '0')
+            bar.setSingleLed((9-i),0);    
+        }    
+}
+
+/** LedBarResource class
+ */
+class LedBarResource : public DynamicResource
+{
+
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the Light resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    LedBarResource(const Logger *logger,const char *name,const bool observable = false) : 
+    DynamicResource(logger,name,"urn:X-ipso:actuator",SN_GRS_GET_ALLOWED|SN_GRS_PUT_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the LED bar
+    @returns string containing either "0" (light off) or "1" (light on) for each LED segment
+    */
+    virtual string get() {
+        return(leds);
+    }
+
+    /**
+    Set the value of the LED bar
+    @param string input the string containing "0" (light off) or "1" (light on) per segment
+    */
+    virtual void put(const string value) {
+        if( sizeof(value) == sizeof(leds) ){
+            leds = (char *)value.c_str();
+            set_leds(leds);
+        }
+    }
+};
+
+#endif // __LEDBAR_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/LightResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/LightResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,91 @@
+/**
+ * @file    LightResource.h
+ * @brief   mbed CoAP Endpoint Light resource supporting CoAP GET and PUT
+ * @author  Doug Anson, Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2014
+ *
+ * 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.
+ */
+
+#ifndef __LIGHT_RESOURCE_H__
+#define __LIGHT_RESOURCE_H__
+
+
+// Base class
+#include "DynamicResource.h"
+
+// our Light
+#include "ChainableLED.h"
+#define LED_COUNT 1
+
+ChainableLED led_chain(D3, D4, LED_COUNT);
+
+static char * led_value = {"00000"}; //RRGGBB
+
+void set_led_array(char * color_string)
+{
+    int color_int;
+
+    sscanf(color_string, "%X", &color_int);
+    
+    led_chain.setColorRGB(0, (color_int >> 16 & 255), (color_int >> 8 & 255), (color_int & 255) );    
+}
+
+/** LightResource class
+ */
+class LightResource : public DynamicResource
+{
+
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the Light resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    LightResource(const Logger *logger,const char *name,const bool observable = false) : DynamicResource(logger,name,"Light",SN_GRS_GET_ALLOWED|SN_GRS_PUT_ALLOWED,observable) {
+    set_led_array("000000");
+    wait(0.5);
+    set_led_array("FF0000");
+    wait(0.5);
+    set_led_array("00FF00");
+    wait(0.5);
+    set_led_array("0000FF");
+    wait(0.5);
+    set_led_array(led_value);
+    }
+
+    /**
+    Get the value of the Light
+    @returns string containing either "0" (light off) or "1" (light on)
+    */
+    virtual string get() {
+        return(led_value);
+    }
+
+    /**
+    Set the value of the Light
+    @param string input the string containing "0" (light off) or "1" (light on)
+    */
+    virtual void put(const string value) {
+        if( sizeof(value) == sizeof(led_value) ){
+            led_value = (char *)value.c_str();
+            set_led_array(led_value);
+        }
+    }
+};
+
+#endif // __LIGHT_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/LoudnessResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/LoudnessResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,60 @@
+/**
+ * @file    LoudnessResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __LOUD_RESOURCE_H__
+#define __LOUD_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+// Loudness Sensor connected to A2
+AnalogIn loud_in(A2);
+
+/** LoudnessResource class
+ */
+class LoudnessResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    LoudnessResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"urn:X-ipso:loudness", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Loudness Sensor
+    @returns string containing the Luminance value 
+    */
+    virtual string get() {
+        char loud_str[6];
+        memset(loud_str,0,6);
+        float loud_read = loud_in.read();
+        sprintf(loud_str,"%6.1f", (loud_read * 100) );
+        return string(loud_str);
+    }
+};
+
+#endif // __LOUD_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/LuminanceResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/LuminanceResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,60 @@
+/**
+ * @file    LuminanceResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __LUMI_RESOURCE_H__
+#define __LUMI_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+// Luminance Sensor connected to A0
+AnalogIn lumi_in(A0);
+
+/** LuminanceResource class
+ */
+class LuminanceResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    LuminanceResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"urn:X-ipso:sensor", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Luminance Sensor
+    @returns string containing the Luminance value 
+    */
+    virtual string get() {
+        char lumi_str[6];
+        memset(lumi_str,0,6);
+        float lumi_read = lumi_in.read();
+        sprintf(lumi_str,"%6.1f", (lumi_read * 100) );
+        return string(lumi_str);
+    }
+};
+
+#endif // __LUMI_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/OnBoardLED.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/OnBoardLED.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,100 @@
+/**
+ * @file    LightResource.h
+ * @brief   mbed CoAP Endpoint Light resource supporting CoAP GET and PUT
+ * @author  Doug Anson, Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2014
+ *
+ * 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.
+ */
+
+#ifndef __LED_RESOURCE_H__
+#define __LED_RESOURCE_H__
+
+
+// Base class
+#include "DynamicResource.h"
+
+// our Light
+DigitalOut LED_red(LED1);
+DigitalOut LED_green(LED2);
+DigitalOut LED_blue(LED3);
+
+static char * LED_color_value = {"0000000"}; //RRGGBBII
+
+void LED_set_color(char * color_string)
+{
+    static uint8_t red, green, blue, index;
+    int color_int;
+
+    sscanf(color_string, "%X", &color_int);
+    
+    index = color_int & 255;
+    blue = color_int >> 8 & 255;
+    green = color_int >> 16 & 255;
+    red = color_int >> 24 & 255;
+        
+    if(index == 0) {
+        LED_red = !(red & 1);    
+        LED_green = !(green & 1);    
+        LED_blue = !(blue & 1);    
+    }
+}
+
+/** LightResource class
+ */
+class LEDResource : public DynamicResource
+{
+
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the Light resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    LEDResource(const Logger *logger,const char *name,const bool observable = false) : DynamicResource(logger,name,"OnBoardLED",SN_GRS_GET_ALLOWED|SN_GRS_PUT_ALLOWED,observable) {
+    LED_set_color("00000000");
+    wait(0.5);
+    LED_set_color("FF000000");
+    wait(0.5);
+    LED_set_color("00FF0000");
+    wait(0.5);
+    LED_set_color("0000FF00");
+    wait(0.5);
+    LED_set_color(LED_color_value);
+    }
+
+    /**
+    Get the value of the LED
+    @returns string containing the last setting
+    */
+    virtual string get() {
+        return(LED_color_value);
+    }
+
+    /**
+    Set the value of the LED
+    @param string input the string containing the desired setting
+    */
+    virtual void put(const string value) {
+        if( sizeof(value) == sizeof(LED_color_value) ){
+            LED_color_value = (char *)value.c_str();
+            LED_set_color(LED_color_value);
+        }
+    }
+};
+
+#endif // __LED_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/PresenceResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/PresenceResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,59 @@
+/**
+ * @file    PresenceResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __PRES_RESOURCE_H__
+#define __PRES_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+// Presence Sensor connected to D2
+DigitalIn pres_in(D2);
+
+/** TempResource class
+ */
+class PresenceResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    PresenceResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"Presence", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Presence Sensor
+    @returns string containing 1 for presence detected, 0 for no presence detected
+    */
+    virtual string get() {
+        if(pres_in.read())
+            return("1");
+        else
+            return("0");
+    }
+};
+
+#endif // __PRES_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 mbedEndpointResources/TempResource.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/TempResource.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,64 @@
+/**
+ * @file    TempResource.h
+ * @brief   mbed CoAP Endpoint
+ * @author  Michael Koster
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2015
+ *
+ * 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.
+ */
+
+#ifndef __TEMP_RESOURCE_H__
+#define __TEMP_RESOURCE_H__
+
+// Base class
+#include "DynamicResource.h"
+
+// Temp Sensor connected to A0
+AnalogIn temp_in(A0);
+
+/** TempResource class
+ */
+class TempResource : public DynamicResource
+{
+public:
+    /**
+    Default constructor
+    @param logger input logger instance for this resource
+    @param name input the resource name
+    @param observable input the resource is Observable (default: FALSE)
+    */
+    TempResource(const Logger *logger,const char *name,const bool observable = false) : 
+        DynamicResource(logger,name,"Temperature", SN_GRS_GET_ALLOWED,observable) {
+    }
+
+    /**
+    Get the value of the Temperature Sensor
+    @returns string containing the temperature value in Fahrenheit
+    */
+    virtual string get() {
+        char temp_str[8];
+        int B = 3975;
+        memset(temp_str,0,8);
+        float temp_read = temp_in.read();
+        float resistance = (1-temp_read) * 10000/temp_read; //get the resistance of the sensor;
+        float temp_c = 1/ ( logf(resistance/10000)/B + 1/298.15) -273.15;//convert to temperature via datasheet ;
+        float temp_f = (1.8 * (double) temp_c) + 32;
+        sprintf(temp_str,"%8.2f", temp_f);
+        return string(temp_str);
+    }
+};
+
+#endif // __TEMP_RESOURCE_H__
diff -r 000000000000 -r f299ce844c09 nsp_configuration.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nsp_configuration.h	Tue May 19 21:34:25 2015 +0000
@@ -0,0 +1,42 @@
+/**
+ * @file    nsp_configuration.h
+ * @brief   mbed Connector Interface NSP configuration header
+ * @author  Doug Anson
+ * @version 1.0
+ * @see
+ *
+ * Copyright (c) 2014
+ *
+ * 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.
+ */
+ 
+ #ifndef __NSP_CONFIGURATION_H__
+ #define __NSP_CONFIGURATION_H__
+ 
+ // NSP node name
+ #define NODE_NAME_LENGTH         24
+ #define NODE_NAME                "mbed-endpoint"
+ 
+ // NSP Address (4 bytes for IPV4, 16 bytes for IPV6)
+ #define NSP_IP_ADDRESS_LENGTH    16
+ #define NSP_IP_ADDRESS           {0x20,0x02,0x0d,0xb4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26}
+ 
+ // NSP Endpoint Type specification
+ #define NSP_ENDPOINT_TYPE_LENGTH 24
+ #define NSP_ENDPOINT_TYPE        "mbed-device"
+ 
+ // NSP Domain used
+ #define NSP_DOMAIN_LENGTH        24
+ #define NSP_DOMAIN               "domain"
+
+ #endif // __NSP_CONFIGURATION_H__
\ No newline at end of file