1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-07-29 02:02:00 +03:00

Cleanup and prepare for publishing.

This commit is contained in:
Tony DiCola
2015-06-10 15:38:34 -07:00
parent d063469e03
commit 6a740d4004
12 changed files with 259 additions and 29 deletions

View File

@ -1,3 +1,16 @@
/***************************************************
Adafruit MQTT Library CC3000 Example
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_SleepyDog.h>
#include <Adafruit_CC3000.h>
#include <SPI.h>
@ -13,11 +26,6 @@
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
// Alternate config:
//#define ADAFRUIT_CC3000_IRQ 2
//#define ADAFRUIT_CC3000_VBAT 8
//#define ADAFRUIT_CC3000_CS 10
/************************* WiFi Access Point *********************************/
#define WLAN_SSID "...your SSID..." // can't be longer than 32 characters!
@ -32,11 +40,6 @@
#define AIO_USERNAME "...your AIO username (see https://accounts.adafruit.com)..."
#define AIO_KEY "...your AIO key...";
/* Debug server configuration (not normally used):
#define AIO_SERVER "apt.adafruit.com"
#define AIO_SERVERPORT 1883
*/
/************ Global State (you don't need to change this!) ******************/
// Setup the main CC3000 class, just like a normal CC3000 sketch.

View File

@ -1,6 +1,19 @@
// Adafruit IO MQTT Example for ESP8266.
// Must be using ESP8266 Arduino from:
// https://github.com/esp8266/Arduino
/***************************************************
Adafruit MQTT Library ESP8266 Example
Must use ESP8266 Arduino from:
https://github.com/esp8266/Arduino
Works great with Adafruit's Huzzah ESP board:
----> https://www.adafruit.com/product/2471
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Tony DiCola for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
@ -17,11 +30,6 @@
#define AIO_USERNAME "...your AIO username (see https://accounts.adafruit.com)..."
#define AIO_KEY "...your AIO key...";
/* Debug server configuration (not normally used):
#define AIO_SERVER "apt.adafruit.com"
#define AIO_SERVERPORT 1883
*/
/************ Global State (you don't need to change this!) ******************/
// Create an ESP8266 WiFiClient class to connect to the MQTT server.

View File

@ -1,3 +1,22 @@
/***************************************************
Adafruit MQTT Library FONA Example
Designed specifically to work with the Adafruit FONA
----> http://www.adafruit.com/products/1946
----> http://www.adafruit.com/products/1963
----> http://www.adafruit.com/products/2468
----> http://www.adafruit.com/products/2542
These cellular modules use TTL Serial to communicate, 2 pins are
required to interface.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_SleepyDog.h>
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
@ -97,7 +116,6 @@ void loop() {
// check if we're still connected
if (!fona.TCPconnected() || (txfailures >= MAXTXFAILURES)) {
//////////////////////////////
Serial.println(F("Connecting to MQTT..."));
int8_t ret, retries = 5;
while (retries && (ret = mqtt.connect()) != 0) {