fork of chris cause ide is stupid
Dependencies: Chainable_RGB_LED mbed mbedConnectorInterface mbedEndpointNetwork
Fork of Trail by
Revision 2:f72204758515, committed 2015-05-28
- Comitter:
- jowil
- Date:
- Thu May 28 23:25:20 2015 +0000
- Parent:
- 1:b96a11b680dc
- Commit message:
- progress;
Changed in this revision
diff -r b96a11b680dc -r f72204758515 main.cpp --- a/main.cpp Fri May 22 00:39:20 2015 +0000 +++ b/main.cpp Thu May 28 23:25:20 2015 +0000 @@ -63,20 +63,22 @@ #include "SliderResource.h" SliderResource slider(&logger,"3202/0/5600", true); /* true if observable */ +// 3203 is analogue output #include "UV.h" -UVResource uv(&logger,"3311/2/5706"); +UVResource uv(&logger,"uv"); +// 3303 is temperature IPSO #include "Temp.h" -TempResource temp(&logger, "3311/3/5706"); +TempResource temp(&logger, "temp"); +// 3201 is digital output #include "Motion.h" -MotionResource motion(&logger, "3311/4/5706"); +MotionResource motion(&logger, "motion"); #include "mbed.h" - // Set our own unique endpoint name -#define MY_ENDPOINT_NAME "TrailTraffic" +#define MY_ENDPOINT_NAME "trailtraffic" // My NSP Domain #define MY_NSP_DOMAIN "trail" @@ -91,7 +93,10 @@ { // Build the endpoint configuration parameters logger.log("configure_endpoint: building endpoint configuration..."); - slider.setMaxAge(0); /* MaxAge = 0 to disable caching of the slide value in the Device Server */ + /* MaxAge = 0 to disable caching of the slide value in the Device Server */ + temp.setMaxAge(0); + uv.setMaxAge(0); + motion.setMaxAge(0); return config.setEndpointNodename(MY_ENDPOINT_NAME) // custom endpoint name .setNSPAddress(my_nsp_address) // custom NSP address .setDomain(MY_NSP_DOMAIN) // custom NSP domain @@ -101,10 +106,7 @@ .addResource(&mfg) .addResource(&model) - // Add my specific physical dynamic resources... - .addResource(&light) - .addResource(&slider, 10000) - .addResource(&led) + // Add my specific physical dynamic resources .addResource(&temp) .addResource(&uv) .addResource(&motion) @@ -112,7 +114,6 @@ .build(); } - // main entry point... int main() {
diff -r b96a11b680dc -r f72204758515 mbedEndpointResources/Motion.h --- a/mbedEndpointResources/Motion.h Fri May 22 00:39:20 2015 +0000 +++ b/mbedEndpointResources/Motion.h Thu May 28 23:25:20 2015 +0000 @@ -28,13 +28,13 @@ #include "DynamicResource.h" #include "mbed.h" - InterruptIn sensorMotion(D2); int motions = 0; void irq_handler(void) { motions++; + logger.log("motion detected %d\n", motions); } /** LightResource class
diff -r b96a11b680dc -r f72204758515 mbedEndpointResources/UV.h --- a/mbedEndpointResources/UV.h Fri May 22 00:39:20 2015 +0000 +++ b/mbedEndpointResources/UV.h Thu May 28 23:25:20 2015 +0000 @@ -60,5 +60,4 @@ } }; -#endif // __UV_RESOURCE_H__ - +#endif // __UV_RESOURCE_H__ \ No newline at end of file