Last active
September 21, 2017 16:16
-
-
Save PharkMillups/c371718d9d2df437434bfc925aef94c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2017, Helium Systems, Inc. | |
* All Rights Reserved. See LICENCE.txt for license information | |
*/ | |
#include "Arduino.h" | |
#include "Board.h" | |
#include "Helium.h" | |
#include "HeliumUtil.h" | |
// NOTE: Please ensure you've created a channel with the above | |
// CHANNEL_NAME as it's name. | |
#define CHANNEL_NAME "Helium MQTT" | |
Helium helium(&atom_serial); | |
Channel channel(&helium); | |
void | |
setup() | |
{ | |
Serial.begin(9600); | |
DBG_PRINTLN(F("Starting")); | |
// Begin communication with the Helium Atom | |
// The baud rate differs per supported board | |
// and is configured in Board.h | |
helium.begin(HELIUM_BAUD_RATE); | |
// Connect the Atom to the Helium Network | |
helium_connect(&helium); | |
// Begin communicating with the channel. This should only need to | |
// be done once. The HeliumUtil functions add simple retry logic | |
// to re-create a channel if it disconnects. | |
channel_create(&channel, CHANNEL_NAME); | |
} | |
void | |
loop() | |
{ | |
const char * data = "Hello Helium!"; | |
// Send data to channel | |
channel_send(&channel, CHANNEL_NAME, data, strlen(data)); | |
// Wait about 5 seconds | |
delay(5000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment