Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Revision:
2:d5f5207e8b2a
Parent:
1:521604503e81
Child:
3:0d3492ebb1a5
--- a/main.cpp	Fri Oct 19 02:01:38 2018 +0000
+++ b/main.cpp	Mon Oct 22 22:59:34 2018 +0000
@@ -159,6 +159,9 @@
  */
 void registered(const ConnectorClientEndpointInfo *endpoint) {
     printf("Connected to Mbed Cloud. Endpoint Name: %s\n", endpoint->internal_endpoint_name.c_str());
+    Ticker timer;
+    timer.attach(eventQueue.event(&fake_button_press), 5.0);
+    HTS221Thread.start(HTS221Handler);
 }
 
 int main(void) {
@@ -248,9 +251,7 @@
 
     // Placeholder for callback to update local resource when GET comes.
     // The timer fires on an interrupt context, but debounces it to the eventqueue, so it's safe to do network operations
-    Ticker timer;
-    timer.attach(eventQueue.event(&fake_button_press), 5.0);
-    HTS221Thread.start(HTS221Handler);
+
     
     // You can easily run the eventQueue in a separate thread if required
     eventQueue.dispatch_forever();