Skip to content

Commit f1d9f08

Browse files
author
brentru
committed
add device information sketch
1 parent 8409945 commit f1d9f08

File tree

3 files changed

+127
-2
lines changed

3 files changed

+127
-2
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Adafruit IO Device Information
2+
// desc: Displays Device, WiFi, and Adafruit IO connection information
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) 2018 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+
// device mac address
23+
byte mac[6];
24+
25+
void setup() {
26+
27+
// start the serial connection
28+
Serial.begin(115200);
29+
30+
// wait for serial monitor to open
31+
while(! Serial);
32+
33+
Serial.print("Connecting to Adafruit IO...");
34+
35+
// connect to io.adafruit.com
36+
io.connect();
37+
38+
// wait for a connection
39+
while(io.status() < AIO_CONNECTED) {
40+
Serial.print(".");
41+
delay(500);
42+
}
43+
Serial.println();
44+
45+
// Device Info
46+
Serial.println("----DEVICE INFO----");
47+
IPAddress ip = WiFi.localIP();
48+
Serial.print("IP Address: ");
49+
Serial.println(ip);
50+
51+
WiFi.macAddress(mac);
52+
Serial.print("MAC Address: ");
53+
for(int i=0;i<6;i++) {
54+
Serial.print(mac[i], HEX);
55+
}
56+
Serial.println();
57+
58+
// Network Info
59+
Serial.println("----ROUTER INFO----");
60+
Serial.print("WIFI SSID: ");
61+
Serial.println(WIFI_SSID);
62+
Serial.print("WIFI Pass: ");
63+
Serial.println(WIFI_PASS);
64+
long rssi = WiFi.RSSI();
65+
Serial.print("RSSI:");
66+
Serial.println(rssi);
67+
68+
// Adafruit IO Info
69+
Serial.println("----ADAFRUIT IO INFO----");
70+
Serial.print("IO User: ");
71+
Serial.println(IO_USERNAME);
72+
Serial.print("IO Key: ");
73+
Serial.println(IO_KEY);
74+
Serial.print("IO Status: ");
75+
Serial.println(io.statusText());
76+
77+
}
78+
79+
void loop(){
80+
81+
}
82+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 M0 WiFi -> https://www.adafruit.com/products/3010
14+
// - Feather WICED -> https://www.adafruit.com/products/3056
15+
16+
#define WIFI_SSID "your_ssid"
17+
#define WIFI_PASS "your_pass"
18+
19+
// comment out the following two lines if you are using fona or ethernet
20+
#include "AdafruitIO_WiFi.h"
21+
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
22+
23+
24+
/******************************* FONA **************************************/
25+
26+
// the AdafruitIO_FONA client will work with the following boards:
27+
// - Feather 32u4 FONA -> https://www.adafruit.com/product/3027
28+
29+
// uncomment the following two lines for 32u4 FONA,
30+
// and comment out the AdafruitIO_WiFi client in the WIFI section
31+
// #include "AdafruitIO_FONA.h"
32+
// AdafruitIO_FONA io(IO_USERNAME, IO_KEY);
33+
34+
35+
/**************************** ETHERNET ************************************/
36+
37+
// the AdafruitIO_Ethernet client will work with the following boards:
38+
// - Ethernet FeatherWing -> https://www.adafruit.com/products/3201
39+
40+
// uncomment the following two lines for ethernet,
41+
// and comment out the AdafruitIO_WiFi client in the WIFI section
42+
// #include "AdafruitIO_Ethernet.h"
43+
// AdafruitIO_Ethernet io(IO_USERNAME, IO_KEY);

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name=Adafruit IO Arduino
2-
version=2.7.7
2+
version=2.7.8
33
author=Adafruit
4-
maintainer=Adafruit <info@adafruit.com>
4+
maintainer=Adafruit <adafruitio@adafruit.com>
55
sentence=Arduino library to access Adafruit IO.
66
paragraph=Arduino library to access Adafruit IO using the Adafruit ESP8266, ESP32, M0 WINC1500, WICED, MKR1000, Ethernet, or FONA hardware.
77
category=Communication

0 commit comments

Comments
 (0)