Skip to content

Commit faad899

Browse files
committed
simplify feeds in examples
1 parent 5e46585 commit faad899

File tree

6 files changed

+14
-29
lines changed

6 files changed

+14
-29
lines changed

examples/adafruitio_errors_esp8266/adafruitio_errors_esp8266.ino

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,15 @@ Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO
4646

4747
// Setup a feed called 'photocell' for publishing.
4848
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
49-
#define PHOTOCELL_FEED AIO_USERNAME "/feeds/photocell"
50-
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED);
49+
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell");
5150

5251
// Setup a feed called 'onoff' for subscribing to changes.
53-
#define ONOFF_FEED AIO_USERNAME "/feeds/onoff"
54-
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
52+
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/onoff");
5553

5654
/*************************** Error Reporting *********************************/
5755

58-
#define ERROR_FEED AIO_USERNAME "/errors"
59-
Adafruit_MQTT_Subscribe errors = Adafruit_MQTT_Subscribe(&mqtt, ERROR_FEED);
60-
61-
#define THROTTLE_FEED AIO_USERNAME "/throttle"
62-
Adafruit_MQTT_Subscribe throttle = Adafruit_MQTT_Subscribe(&mqtt, THROTTLE_FEED);
56+
Adafruit_MQTT_Subscribe errors = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/errors");
57+
Adafruit_MQTT_Subscribe throttle = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/throttle");
6358

6459
/*************************** Sketch Code ************************************/
6560

examples/adafruitio_secure_esp8266/adafruitio_secure_esp8266.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ const char* fingerprint = "26 96 1C 2A 51 07 FD 15 80 96 93 AE F7 32 CE B9 0D 01
4545

4646
/****************************** Feeds ***************************************/
4747

48-
// Setup a feed called 'photocell' for publishing.
48+
// Setup a feed called 'test' for publishing.
4949
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
50-
#define TEST_FEED AIO_USERNAME "/feeds/test"
51-
Adafruit_MQTT_Publish test = Adafruit_MQTT_Publish(&mqtt, TEST_FEED);
50+
Adafruit_MQTT_Publish test = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/test");
5251

5352
/*************************** Sketch Code ************************************/
5453

examples/mqtt_2subs_esp8266/mqtt_2subs_esp8266.ino

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO
4949
/****************************** Feeds ***************************************/
5050

5151
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
52-
// Setup a feed called 'onoff' for subscribing to changes.
53-
#define ONOFF_FEED AIO_USERNAME "/feeds/onoff"
54-
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
55-
#define SLIDER_FEED AIO_USERNAME "/feeds/slider"
56-
Adafruit_MQTT_Subscribe slider = Adafruit_MQTT_Subscribe(&mqtt, SLIDER_FEED);
52+
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/onoff");
53+
Adafruit_MQTT_Subscribe slider = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/slider");
5754

5855
/*************************** Sketch Code ************************************/
5956

examples/mqtt_cc3k/mqtt_cc3k.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ boolean CC3000connect(const char* wlan_ssid, const char* wlan_pass, uint8_t wlan
5959

6060
// Setup a feed called 'photocell' for publishing.
6161
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
62-
#define PHOTOCELL_FEED AIO_USERNAME "/feeds/photocell"
63-
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED);
62+
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell");
6463

6564
// Setup a feed called 'onoff' for subscribing to changes.
66-
#define ONOFF_FEED AIO_USERNAME "/feeds/onoff"
67-
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
65+
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/onoff");
6866

6967
/*************************** Sketch Code ************************************/
7068

examples/mqtt_esp8266/mqtt_esp8266.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO
4545

4646
// Setup a feed called 'photocell' for publishing.
4747
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
48-
#define PHOTOCELL_FEED AIO_USERNAME "/feeds/photocell"
49-
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED);
48+
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell");
5049

5150
// Setup a feed called 'onoff' for subscribing to changes.
52-
#define ONOFF_FEED AIO_USERNAME "/feeds/onoff"
53-
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
51+
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/onoff");
5452

5553
/*************************** Sketch Code ************************************/
5654

examples/mqtt_fona/mqtt_fona.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *u
6767

6868
// Setup a feed called 'photocell' for publishing.
6969
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
70-
#define PHOTOCELL_FEED AIO_USERNAME "/feeds/photocell"
71-
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED);
70+
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell");
7271

7372
// Setup a feed called 'onoff' for subscribing to changes.
74-
#define ONOFF_FEED AIO_USERNAME "/feeds/onoff"
75-
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
73+
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/onoff");
7674

7775
/*************************** Sketch Code ************************************/
7876

0 commit comments

Comments
 (0)