Created
June 25, 2020 06:42
-
-
Save mongonta0716/65b018885a2ccfaef49d691a042ebfdf to your computer and use it in GitHub Desktop.
WiFi Test for M5StickC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <M5StickC.h> | |
#include <WiFi.h> | |
const char ssid[] = "ssid"; | |
const char pass[] = "pass"; | |
void setup() { | |
M5.begin(); | |
M5.Lcd.init(); | |
M5.Lcd.setRotation(3); | |
M5.Lcd.fillScreen(TFT_BLACK); | |
M5.Lcd.setCursor(0, 0); | |
M5.Lcd.setTextSize(1); | |
WiFi.begin(ssid, pass); | |
while (WiFi.status() != WL_CONNECTED) { | |
M5.Lcd.print("."); | |
delay(500); | |
} | |
M5.Lcd.println("\nWiFi connected"); | |
M5.Lcd.println(WiFi.localIP()); | |
uint8_t mac0[6]; | |
esp_efuse_mac_get_default(mac0); | |
Serial.printf("Default Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac0[0], mac0[1], mac0[2], mac0[3], mac0[4], mac0[5]); | |
uint8_t mac1[6]; | |
esp_efuse_read_mac(mac1); | |
Serial.printf("EFuse Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac1[0], mac1[1], mac1[2], mac1[3], mac1[4], mac1[5]); | |
uint8_t mac2[6]; | |
system_efuse_read_mac(mac2); | |
Serial.printf("System Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac2[0], mac2[1], mac2[2], mac2[3], mac2[4], mac2[5]); | |
uint8_t mac3[6]; | |
esp_read_mac(mac3, ESP_MAC_WIFI_STA); | |
Serial.printf("[Wi-Fi Station] Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac3[0], mac3[1], mac3[2], mac3[3], mac3[4], mac3[5]); | |
uint8_t mac4[7]; | |
esp_read_mac(mac4, ESP_MAC_WIFI_SOFTAP); | |
Serial.printf("[Wi-Fi SoftAP] Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac4[0], mac4[1], mac4[2], mac4[3], mac4[4], mac4[5]); | |
uint8_t mac5[6]; | |
esp_read_mac(mac5, ESP_MAC_BT); | |
Serial.printf("[Bluetooth] Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac5[0], mac5[1], mac5[2], mac5[3], mac5[4], mac5[5]); | |
uint8_t mac6[6]; | |
esp_read_mac(mac6, ESP_MAC_ETH); | |
Serial.printf("[Ethernet] Mac Address = %02X:%02X:%02X:%02X:%02X:%02X\n", mac6[0], mac6[1], mac6[2], mac6[3], mac6[4], mac6[5]); | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment