1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-06-11 22:48:09 +03:00

remove progmem from examples

This commit is contained in:
Todd Treece
2016-08-15 13:06:17 -04:00
parent b61d7e7024
commit e0c88d8d2c
7 changed files with 22 additions and 58 deletions

View File

@ -39,32 +39,26 @@ WiFiClient client;
// or... use WiFiFlientSecure for SSL
//WiFiClientSecure client;
// Store the MQTT server, username, and password in flash memory.
// This is required for using the Adafruit MQTT library.
const char MQTT_SERVER[] PROGMEM = AIO_SERVER;
const char MQTT_USERNAME[] PROGMEM = AIO_USERNAME;
const char MQTT_PASSWORD[] PROGMEM = AIO_KEY;
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, AIO_SERVERPORT, MQTT_USERNAME, MQTT_PASSWORD);
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
/****************************** Feeds ***************************************/
// Setup a feed called 'photocell' for publishing.
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
const char PHOTOCELL_FEED[] PROGMEM = AIO_USERNAME "/feeds/photocell";
#define PHOTOCELL_FEED AIO_USERNAME "/feeds/photocell"
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED);
// Setup a feed called 'onoff' for subscribing to changes.
const char ONOFF_FEED[] PROGMEM = AIO_USERNAME "/feeds/onoff";
#define ONOFF_FEED AIO_USERNAME "/feeds/onoff"
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
/*************************** Error Reporting *********************************/
const char ERROR_FEED[] PROGMEM = AIO_USERNAME "/errors";
#define ERROR_FEED AIO_USERNAME "/errors"
Adafruit_MQTT_Subscribe errors = Adafruit_MQTT_Subscribe(&mqtt, ERROR_FEED);
const char THROTTLE_FEED[] PROGMEM = AIO_USERNAME "/throttle";
#define THROTTLE_FEED AIO_USERNAME "/throttle"
Adafruit_MQTT_Subscribe throttle = Adafruit_MQTT_Subscribe(&mqtt, THROTTLE_FEED);
/*************************** Sketch Code ************************************/