
ok connect ethernet http://nanoservice-demo.mbed.org/ logout login name/password: demo demo see unique id on LCD click on that on that SAME id on web page interact with it: led on/off temp buzzer etc.
Dependencies: Beep C12832_lcd EthernetInterface LM75B MMA7660 mbed-rtos mbed nsdl_lib
Fork of NSDL_HelloWorld by
Diff: resources/temperature.cpp
- Revision:
- 3:52c1b649eb04
- Parent:
- 2:7e489126fe7a
--- a/resources/temperature.cpp Tue Oct 15 12:45:46 2013 +0000 +++ b/resources/temperature.cpp Tue Oct 15 15:48:23 2013 +0000 @@ -11,7 +11,7 @@ static LM75B tmp(p28,p27); /* stored data for observable resource */ static uint8_t obs_number = 0; -static uint8_t *obs_token_ptr = 0; +static uint8_t *obs_token_ptr = NULL; static uint8_t obs_token_len = 0; static char temp_val[5]; extern Serial pc; @@ -26,7 +26,7 @@ wait(1); time++; sn_nsdl_exec(time); - if((!(time % 10)) && obs_number != 0) + if((!(time % 10)) && obs_number != 0 && obs_token_ptr != NULL) { obs_number++; sprintf(temp_val,"%2.2f" ,tmp.read()); @@ -45,7 +45,7 @@ sprintf(temp_val,"%2.2f" ,tmp.read()); sn_coap_hdr_s *coap_res_ptr = 0; - //pc.printf("temp callback\r\n"); + pc.printf("temp callback\r\n"); coap_res_ptr = sn_coap_build_response(received_coap_ptr, COAP_MSG_CODE_RESPONSE_CONTENT); coap_res_ptr->payload_len = 5; @@ -85,7 +85,7 @@ int create_temperature_resource(sn_nsdl_resource_info_s *resource_ptr) { - Thread exec_thread(exec_call_thread); + static Thread exec_thread(exec_call_thread); nsdl_create_dynamic_resource(resource_ptr, sizeof(TEMP_RES_ID)-1, (uint8_t*)TEMP_RES_ID, 0, 0, 1, &temp_resource_cb, SN_GRS_GET_ALLOWED); return 0;