Skip to content

Instantly share code, notes, and snippets.

@PharkMillups
Last active September 21, 2017 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PharkMillups/c371718d9d2df437434bfc925aef94c8 to your computer and use it in GitHub Desktop.
Save PharkMillups/c371718d9d2df437434bfc925aef94c8 to your computer and use it in GitHub Desktop.
/*
* 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