Anniversary Sale · up to 80% off all librariesEnds Nov 9Shop now
SOFTTDocs
Cards
You are reading the documentation for ESP-DASH v4.x.x, which is no longer the latest release. View the v5.x.x documentation.

Link Card

Open a URL from the ESP-DASH Pro v4 dashboard when the user clicks the link card.

ESP-DASH Pro feature. This functionality is available only in the commercial edition of ESP-DASH.

The link card opens a URL when the user clicks it. Use it to link to external resources, documentation or other pages served by the device.

Link card

Constructor

Card link(&dashboard, LINK_CARD, "Documentation");

Prop

Type

Methods

update()

Sets the URL that opens when the user clicks the card. The card has no target until a URL is set.

link.update(const char* url);

Call dashboard.sendUpdates() afterwards to push the change to connected clients.

Example

main.cpp
#include <Arduino.h>
#if defined(ESP8266)
  #include <ESP8266WiFi.h>
  #include <ESPAsyncTCP.h>
#elif defined(ESP32)
  #include <WiFi.h>
  #include <AsyncTCP.h>
#endif
#include <ESPAsyncWebServer.h>
#include <ESPDash.h>

const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";

AsyncWebServer server(80);
ESPDash dashboard(&server);

Card link(&dashboard, LINK_CARD, "Documentation");

void setup() {
  Serial.begin(115200);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  if (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("WiFi connection failed");
    return;
  }
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  link.update("https://espdash.pro");

  server.begin();
}

void loop() {
  // ...
}

On this page