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.
Diff: main.cpp
- Revision:
- 0:9c0bcd840b37
- Child:
- 1:a843f3d9d31c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jun 29 13:05:16 2017 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017, Helium Systems, Inc.
+ * All Rights Reserved. See LICENCE.txt for license information
+ */
+
+#include "mbed.h"
+#include "Helium.h"
+
+Helium helium(PTC17, PTC16);
+Channel channel(&helium);
+
+void report_status(int status)
+{
+ if (helium_status_OK == status) {
+ printf("Succeeded\n");
+ } else {
+ printf("Failed\n");
+ }
+}
+
+void report_status_result(int status, int result)
+{
+ if (helium_status_OK == status) {
+ if (result == 0) {
+ printf("Succeeded\n");
+ } else {
+ printf("Failed - %d", result);
+ }
+ } else {
+ printf("Failed\n");
+ }
+}
+
+
+int main()
+{
+ int status = helium.connect();
+
+ int8_t result;
+ status = channel.begin("Helium Cloud MQTT", &result);
+ report_status(status);
+
+ const char *data = "Hello Helium";
+
+ status = channel.send(data, strlen(data), &result);
+ report_status_result(status, result);
+}