Skip to content

Commit 1ee8c76

Browse files
author
brentru
committed
add skel. for example
1 parent 0ef372c commit 1ee8c76

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Adafruit IO Schedule Trigger Example
2+
// Tutorial Link: https://learn.adafruit.com/adafruit-io-basics-scheduled-triggers/
3+
//
4+
// Adafruit invests time and resources providing this open source code.
5+
// Please support Adafruit and open source hardware by purchasing
6+
// products from Adafruit!
7+
//
8+
// Written by Brent Rubell for Adafruit Industries
9+
// Copyright (c) 2020 Adafruit Industries
10+
// Licensed under the MIT license.
11+
//
12+
// All text above must be included in any redistribution.
13+
14+
/************************** Configuration ***********************************/
15+
16+
// edit the config.h tab and enter your Adafruit IO credentials
17+
// and any additional configuration needed for WiFi, cellular,
18+
// or ethernet clients.
19+
#include "config.h"
20+
21+
/************************ Example Starts Here *******************************/
22+
23+
void setup() {
24+
25+
// start the serial connection
26+
Serial.begin(115200);
27+
28+
// wait for serial monitor to open
29+
while(! Serial);
30+
31+
Serial.print("Connecting to Adafruit IO");
32+
33+
// connect to io.adafruit.com
34+
io.connect();
35+
36+
// wait for a connection
37+
while(io.status() < AIO_CONNECTED) {
38+
Serial.print(".");
39+
delay(500);
40+
}
41+
42+
// we are connected
43+
Serial.println();
44+
Serial.println(io.statusText());
45+
46+
}
47+
48+
void loop() {
49+
50+
// io.run(); is required for all sketches.
51+
// it should always be present at the top of your loop
52+
// function. it keeps the client connected to
53+
// io.adafruit.com, and processes any incoming data.
54+
io.run();
55+
56+
57+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/************************ Adafruit IO Config *******************************/
2+
3+
// visit io.adafruit.com if you need to create an account,
4+
// or if you need your Adafruit IO key.
5+
#define IO_USERNAME "your_username"
6+
#define IO_KEY "your_key"
7+
8+
/******************************* WIFI **************************************/
9+
10+
// the AdafruitIO_WiFi client will work with the following boards:
11+
// - HUZZAH ESP8266 Breakout -> https://www.adafruit.com/products/2471
12+
// - Feather HUZZAH ESP8266 -> https://www.adafruit.com/products/2821
13+
// - Feather HUZZAH ESP32 -> https://www.adafruit.com/product/3405
14+
// - Feather M0 WiFi -> https://www.adafruit.com/products/3010
15+
// - Feather WICED -> https://www.adafruit.com/products/3056
16+
// - Adafruit PyPortal -> https://www.adafruit.com/product/4116
17+
// - Adafruit Metro M4 Express AirLift Lite ->
18+
// https://www.adafruit.com/product/4000
19+
// - Adafruit AirLift Breakout -> https://www.adafruit.com/product/4201
20+
21+
#define WIFI_SSID "your_ssid"
22+
#define WIFI_PASS "your_pass"
23+
24+
// uncomment the following line if you are using airlift
25+
// #define USE_AIRLIFT
26+
27+
// uncomment the following line if you are using winc1500
28+
// #define USE_WINC1500
29+
30+
// comment out the following lines if you are using fona or ethernet
31+
#include "AdafruitIO_WiFi.h"
32+
33+
#if defined(USE_AIRLIFT) || defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) || \
34+
defined(ADAFRUIT_PYPORTAL)
35+
// Configure the pins used for the ESP32 connection
36+
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
37+
// Don't change the names of these #define's! they match the variant ones
38+
#define SPIWIFI SPI
39+
#define SPIWIFI_SS 10 // Chip select pin
40+
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
41+
#define ESP32_RESETN 6 // Reset pin
42+
#define ESP32_GPIO0 -1 // Not connected
43+
#endif
44+
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS,
45+
SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
46+
#else
47+
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
48+
#endif
49+
/******************************* FONA **************************************/
50+
51+
// the AdafruitIO_FONA client will work with the following boards:
52+
// - Feather 32u4 FONA -> https://www.adafruit.com/product/3027
53+
54+
// uncomment the following two lines for 32u4 FONA,
55+
// and comment out the AdafruitIO_WiFi client in the WIFI section
56+
// #include "AdafruitIO_FONA.h"
57+
// AdafruitIO_FONA io(IO_USERNAME, IO_KEY);
58+
59+
/**************************** ETHERNET ************************************/
60+
61+
// the AdafruitIO_Ethernet client will work with the following boards:
62+
// - Ethernet FeatherWing -> https://www.adafruit.com/products/3201
63+
64+
// uncomment the following two lines for ethernet,
65+
// and comment out the AdafruitIO_WiFi client in the WIFI section
66+
// #include "AdafruitIO_Ethernet.h"
67+
// AdafruitIO_Ethernet io(IO_USERNAME, IO_KEY);

0 commit comments

Comments
 (0)