Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed nsdl rgb_sensor_buffer
Fork of mbed_nsdl by
Diff: resources/nespresso.cpp
- Revision:
- 3:8e1117ec91ba
- Parent:
- 2:88a30cc88a86
- Child:
- 4:ab3c8d25260e
--- a/resources/nespresso.cpp Wed Jun 18 16:25:55 2014 +0000
+++ b/resources/nespresso.cpp Mon Jun 30 09:44:00 2014 +0000
@@ -15,6 +15,26 @@
static uint8_t res_nespresso_val[] = {"Decaffeinto Lungo (Orange)"};
+/*
+ *
+ *
+ */
+const char* do_detection()
+{
+ static int counter = 0;
+
+ const char *names[] = {
+ {"VOLLUTO"},
+ {"INDRIYA"},
+ };
+ const int num_names = sizeof(names) / sizeof(names[0]);
+
+ wait_ms(1500);
+
+ counter++;
+ return names[counter % num_names];
+}
+
/* Thread for calling libNsdl exec function (cleanup, resendings etc..) */
/* Node updates nespresso value every 10 seconds. Notification sending is done here. */
static void exec_call_thread(void const *args)
@@ -22,16 +42,19 @@
int32_t time = 0;
while (true)
{
- wait(1);
time++;
sn_nsdl_exec(time);
if((!(time % 10)) && obs_number != 0 && obs_token_ptr != NULL)
{
obs_number++;
- if(sn_nsdl_send_observation_notification(obs_token_ptr, obs_token_len, (uint8_t*)res_nespresso_val, (sizeof(res_nespresso_val)-1), &obs_number, 1, COAP_MSG_TYPE_NON_CONFIRMABLE, 0) == 0)
+ if(sn_nsdl_send_observation_notification(obs_token_ptr, obs_token_len, (uint8_t*)res_nespresso_val, (sizeof(res_nespresso_val)-1), &obs_number, 1, COAP_MSG_TYPE_NON_CONFIRMABLE, 0) == 0)
+ {
pc.printf("Observation sending failed\r\n");
- else
+ }
+ else
+ {
pc.printf("Observation\r\n");
+ }
}
}
}
