diff espNode/desk/src/main.cpp @ 781:6c42c1f64f00

new driver for esp32 and R503 fingerprint sensor
author drewp@bigasterisk.com
date Mon, 24 Aug 2020 01:27:33 -0700
parents
children e4cf795d3677
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/espNode/desk/src/main.cpp	Mon Aug 24 01:27:33 2020 -0700
@@ -0,0 +1,42 @@
+#include <Arduino.h>
+
+#include "display.h"
+#include "fingerprint.h"
+#include "mqtt.h"
+#include "wifi.h"
+
+#define ADC_EN 14
+#define ADC_PIN 34
+
+// #include <Button2.h>
+// #define BUTTON_1 35
+// #define BUTTON_2 0
+
+void setup() {
+  Serial.begin(115200);
+  Serial.println("Serial.begin");
+
+  fingerprint::Setup();  // go early since the others display status on our LED
+  display::Setup();
+  display::Message("Hello world");
+  wifi::Setup();
+  mqtt::Setup();
+}
+
+void loop() {
+  Serial.println("--loop--");
+  fingerprint::ExecuteAnyQueued();
+  fingerprint::ScanLoop();
+  if (mqtt::HasPendingCommand()) {
+    std::string cmd = mqtt::PopPendingCommand();
+    if (cmd == "enroll") {
+      fingerprint::Enroll();
+    } else if (cmd == "show_success") {
+      fingerprint::BlinkSuccess();
+      while (!mqtt::HasPendingCommand()) yield();
+      cmd = mqtt::PopPendingCommand();
+      // hope it's "clear_success", but who cares
+      fingerprint::BlinkClearSuccess();
+    }
+  }
+}