Skip to content

Commit

Permalink
update esptouch example
Browse files Browse the repository at this point in the history
  • Loading branch information
i3water committed Jun 12, 2018
1 parent 422dd8e commit 6c0a2ab
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
40 changes: 40 additions & 0 deletions examples/Blinker_ESPTOUCH/ESPTOUCH_MQTT/ESPTOUCH_MQTT.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#define BLINKER_ESP_SMARTCONFIG

#include <Blinker.h>

char auth[] = "Your MQTT Secret Key";

#define BUTTON_1 "ButtonKey"

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

pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);

Blinker.begin(auth);
Blinker.wInit(BUTTON_1, W_BUTTON);
}

void loop()
{
Blinker.run();

if (Blinker.available()) {
BLINKER_LOG2("Blinker.readString(): ", Blinker.readString());

uint32_t BlinkerTime = millis();

Blinker.beginFormat();
Blinker.vibrate();
Blinker.print("millis", BlinkerTime);
Blinker.endFormat();
}

if (Blinker.button(BUTTON_1)) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
}
38 changes: 38 additions & 0 deletions examples/Blinker_ESPTOUCH/ESPTOUCH_WiFi/ESPTOUCH_WiFi.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#define BLINKER_ESP_SMARTCONFIG

#include <Blinker.h>

#define BUTTON_1 "ButtonKey"

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

pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);

Blinker.begin();
Blinker.wInit(BUTTON_1, W_BUTTON);
}

void loop()
{
Blinker.run();

if (Blinker.available()) {
BLINKER_LOG2("Blinker.readString(): ", Blinker.readString());

uint32_t BlinkerTime = millis();

Blinker.beginFormat();
Blinker.vibrate();
Blinker.print("millis", BlinkerTime);
Blinker.endFormat();
}

if (Blinker.button(BUTTON_1)) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
}

0 comments on commit 6c0a2ab

Please sign in to comment.