From f8ec7fc08f19dde49d9eff230ecac0a02402c55f Mon Sep 17 00:00:00 2001 From: ladyada Date: Tue, 9 Aug 2016 20:12:22 -0400 Subject: [PATCH] simplify and no progmem on yun demo --- examples/mqtt_yun/mqtt_yun.ino | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/examples/mqtt_yun/mqtt_yun.ino b/examples/mqtt_yun/mqtt_yun.ino index b4d39b9..3831c59 100644 --- a/examples/mqtt_yun/mqtt_yun.ino +++ b/examples/mqtt_yun/mqtt_yun.ino @@ -22,7 +22,6 @@ #include "Adafruit_MQTT.h" #include "Adafruit_MQTT_Client.h" - /************************* Adafruit.io Setup *********************************/ #define AIO_SERVER "io.adafruit.com" @@ -30,30 +29,23 @@ #define AIO_USERNAME "...your AIO username (see https://accounts.adafruit.com)..." #define AIO_KEY "...your AIO key..." + /************ Global State (you don't need to change this!) ******************/ -// Create a YunClient instance to communicate using the Yun's brighe & Linux OS. +// Create a YunClient instance to communicate using the Yun's bridge & Linux OS. YunClient 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: /feeds/ -const char PHOTOCELL_FEED[] PROGMEM = AIO_USERNAME "/feeds/photocell"; -Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED); +Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell"); // Setup a feed called 'onoff' for subscribing to changes. -const char ONOFF_FEED[] PROGMEM = AIO_USERNAME "/feeds/onoff"; -Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED); +Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/onoff"); /*************************** Sketch Code ************************************/