c_cpp esp8266-GA-事件tracking.ino

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp esp8266-GA-事件tracking.ino相关的知识,希望对你有一定的参考价值。

// Copyright Nat Weerawan 2015-2016
// MIT License

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiConnector.h>

HTTPClient http;
WiFiConnector *wifi;

#define WIFI_SSID        ""
#define WIFI_PASSPHARSE  ""

uint8_t SMARTCONFIG_BUTTON_PIN = 0;
const String ua = "UA-??????-1";
#include "init_wifi.h"

void init_hardware()
{
  Serial.begin(115200);
  delay(100);
  Serial.flush();
}

void setup()
{
  init_hardware();
  wifi = init_wifi(WIFI_SSID, WIFI_PASSPHARSE, SMARTCONFIG_BUTTON_PIN);
  wifi->setLed(16);

  wifi->on_connected([&](const void* message)
  {
    String url = "http://www.google-analytics.com/collect?v=1&t=event&cid=hello";
    path += "&dh=www.cmmakerclub.com&ec=ESPresso%20Lite&ea=Motion%20Sensor";
    path += "&cm5=1&el=Move!&tid=" + ua;

    http.begin(url.c_str()); //HTTP
    ESP.deepSleep(999999 * 1000000);
  });
  
  wifi->connect();
}

void loop()
{
  wifi->loop();
}

以上是关于c_cpp esp8266-GA-事件tracking.ino的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp AnalogWrite ESP32

c_cpp ESP8266GCodeSender

c_cpp esp8266-webserver.ino

c_cpp esp8266.tv.ino

c_cpp esp8266oled.ino

c_cpp sprintf.esp8266.ino