|
| 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 | + |
0 commit comments