Compare commits
15 Commits
0.17.0
...
master_ups
Author | SHA1 | Date |
---|---|---|
|
a4e1ee0133 | |
|
c25d31f813 | |
|
7fffb1e769 | |
|
f0e97737f7 | |
|
5b25a96d1b | |
|
13854f6487 | |
|
a3f09cfa4c | |
|
2d384b9697 | |
|
974f4b8713 | |
|
ce9bcab0b4 | |
|
786ca3fdb2 | |
|
564f34a84b | |
|
8a8c0b1228 | |
|
1e3fb01778 | |
|
f5bb4e4e97 |
|
@ -81,7 +81,7 @@ bool Adafruit_MQTT_Client::sendPacket(uint8_t *buffer, uint16_t len) {
|
||||||
if (client->connected()) {
|
if (client->connected()) {
|
||||||
// send 250 bytes at most at a time, can adjust this later based on Client
|
// send 250 bytes at most at a time, can adjust this later based on Client
|
||||||
|
|
||||||
uint16_t sendlen = min(len, 250);
|
uint16_t sendlen = len > 250 ? 250 : len;
|
||||||
//Serial.print("Sending: "); Serial.println(sendlen);
|
//Serial.print("Sending: "); Serial.println(sendlen);
|
||||||
ret = client->write(buffer, sendlen);
|
ret = client->write(buffer, sendlen);
|
||||||
DEBUG_PRINT(F("Client sendPacket returned: ")); DEBUG_PRINTLN(ret);
|
DEBUG_PRINT(F("Client sendPacket returned: ")); DEBUG_PRINTLN(ret);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Adafruit MQTT Library [![Build Status](https://travis-ci.org/adafruit/Adafruit_MQTT_Library.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_MQTT_Library)
|
# Adafruit MQTT Library [![Build Status](https://travis-ci.org/adafruit/Adafruit_MQTT_Library.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_MQTT_Library)
|
||||||
|
|
||||||
Arduino library for MQTT support, including access to Adafruit IO. Works with
|
Arduino library for MQTT support, including access to Adafruit IO. Works with
|
||||||
the Adafruit CC3000, FONA, Arduino Yun, ESP8266 Arduino platforms, and anything that supports
|
the Adafruit FONA, Arduino Yun, ESP8266 Arduino platforms, and anything that supports
|
||||||
Arduino's Client interface (like Ethernet shield).
|
Arduino's Client interface (like Ethernet shield).
|
||||||
|
|
||||||
See included examples for how to use the library to access an MQTT service to
|
See included examples for how to use the library to access an MQTT service to
|
||||||
|
@ -11,10 +11,7 @@ spec but is intended to support enough for QoS 0 and 1 publishing.
|
||||||
Depends on the following other libraries depending on the target platform:
|
Depends on the following other libraries depending on the target platform:
|
||||||
|
|
||||||
- [Adafruit SleepyDog](https://github.com/adafruit/Adafruit_SleepyDog), watchdog
|
- [Adafruit SleepyDog](https://github.com/adafruit/Adafruit_SleepyDog), watchdog
|
||||||
library used by FONA and CC3000 code for reliability.
|
library used by FONA code for reliability.
|
||||||
|
|
||||||
- [Adafruit CC3000](https://github.com/adafruit/Adafruit_CC3000_Library), required
|
|
||||||
for the CC3000 hardware.
|
|
||||||
|
|
||||||
- [Adafruit FONA](https://github.com/adafruit/Adafruit_FONA_Library), required for
|
- [Adafruit FONA](https://github.com/adafruit/Adafruit_FONA_Library), required for
|
||||||
the FONA hardware.
|
the FONA hardware.
|
||||||
|
|
|
@ -40,8 +40,9 @@ WiFiClientSecure client;
|
||||||
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
|
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
|
||||||
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
|
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
|
||||||
|
|
||||||
// io.adafruit.com SHA1 fingerprint
|
// io.adafruit.com SHA1 fingerprint. Current fingerprint can be verified via:
|
||||||
const char* fingerprint = "26 96 1C 2A 51 07 FD 15 80 96 93 AE F7 32 CE B9 0D 01 55 C4";
|
// echo | openssl s_client -connect io.adafruit.com:443 |& openssl x509 -fingerprint -noout
|
||||||
|
#define AIO_SSL_FINGERPRINT "77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18"
|
||||||
|
|
||||||
/****************************** Feeds ***************************************/
|
/****************************** Feeds ***************************************/
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "Adafruit_MQTT.h"
|
#include "Adafruit_MQTT.h"
|
||||||
#include "Adafruit_MQTT_Client.h"
|
#include "Adafruit_MQTT_Client.h"
|
||||||
#include <Adafruit_WINC1500.h>
|
#include <WiFi101.h>
|
||||||
|
|
||||||
|
|
||||||
/************************* WiFI Setup *****************************/
|
/************************* WiFI Setup *****************************/
|
||||||
#define WINC_CS 8
|
#define WINC_CS 8
|
||||||
|
@ -20,8 +19,6 @@
|
||||||
#define WINC_RST 4
|
#define WINC_RST 4
|
||||||
#define WINC_EN 2 // or, tie EN to VCC
|
#define WINC_EN 2 // or, tie EN to VCC
|
||||||
|
|
||||||
Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);
|
|
||||||
|
|
||||||
char ssid[] = "yournetwork"; // your network SSID (name)
|
char ssid[] = "yournetwork"; // your network SSID (name)
|
||||||
char pass[] = "yourpassword"; // your network password (use for WPA, or use as key for WEP)
|
char pass[] = "yourpassword"; // your network password (use for WPA, or use as key for WEP)
|
||||||
int keyIndex = 0; // your network key Index number (needed only for WEP)
|
int keyIndex = 0; // your network key Index number (needed only for WEP)
|
||||||
|
@ -38,7 +35,7 @@ int status = WL_IDLE_STATUS;
|
||||||
/************ Global State (you don't need to change this!) ******************/
|
/************ Global State (you don't need to change this!) ******************/
|
||||||
|
|
||||||
//Set up the wifi client
|
//Set up the wifi client
|
||||||
Adafruit_WINC1500Client client;
|
WiFiClient client;
|
||||||
|
|
||||||
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
|
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
|
||||||
|
|
||||||
|
@ -60,10 +57,7 @@ Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAM
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
#ifdef WINC_EN
|
WiFi.setPins(WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);
|
||||||
pinMode(WINC_EN, OUTPUT);
|
|
||||||
digitalWrite(WINC_EN, HIGH);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (!Serial);
|
while (!Serial);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
@ -154,4 +148,4 @@ void MQTT_connect() {
|
||||||
delay(5000); // wait 5 seconds
|
delay(5000); // wait 5 seconds
|
||||||
}
|
}
|
||||||
Serial.println("MQTT Connected!");
|
Serial.println("MQTT Connected!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ Adafruit_MQTT_CC3000 KEYWORD1
|
||||||
Adafruit_MQTT_FONA KEYWORD1
|
Adafruit_MQTT_FONA KEYWORD1
|
||||||
Adafruit_MQTT_Client KEYWORD1
|
Adafruit_MQTT_Client KEYWORD1
|
||||||
Adafruit_MQTT_Publish KEYWORD1
|
Adafruit_MQTT_Publish KEYWORD1
|
||||||
Adafruit_MQTT_Subscribe KEYWORD1
|
Adafruit_MQTT_Subscribe KEYWORD1
|
||||||
connect KEYWORD2
|
connect KEYWORD2
|
||||||
connectErrorString KEYWORD2
|
connectErrorString KEYWORD2
|
||||||
disconnect KEYWORD2
|
disconnect KEYWORD2
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
name=Adafruit MQTT Library
|
name=Adafruit MQTT Library
|
||||||
version=0.17.0
|
version=0.20.1
|
||||||
author=Adafruit
|
author=Adafruit
|
||||||
maintainer=Adafruit <info@adafruit.com>
|
maintainer=Adafruit <info@adafruit.com>
|
||||||
sentence=MQTT library that supports the CC3000, FONA, ESP8266, Yun, and generic Arduino Client hardware.
|
sentence=MQTT library that supports the FONA, ESP8266, Yun, and generic Arduino Client hardware.
|
||||||
paragraph=Simple MQTT library that supports the bare minimum to publish and subscribe to topics.
|
paragraph=Simple MQTT library that supports the bare minimum to publish and subscribe to topics.
|
||||||
category=Communication
|
category=Communication
|
||||||
url=https://github.com/adafruit/Adafruit_MQTT_Library
|
url=https://github.com/adafruit/Adafruit_MQTT_Library
|
||||||
|
|
Loading…
Reference in New Issue