From 230f0cb2914b02c4d70b19ac4358f2a0a078a676 Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <tullivan99@gmail.com>
Date: Sat, 30 Mar 2019 17:17:58 -0400
Subject: better scrolling, vibration

---
 source/vibrate.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 source/vibrate.hpp

(limited to 'source/vibrate.hpp')

diff --git a/source/vibrate.hpp b/source/vibrate.hpp
new file mode 100644
index 0000000..55eb511
--- /dev/null
+++ b/source/vibrate.hpp
@@ -0,0 +1,42 @@
+/**
+ * @file vibrate.hpp
+ * @brief Provides access to the vibration motor.
+ *
+ * Copyright (C) 2019 Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef VIBRATE_HPP_
+#define VIBRATE_HPP_
+
+class Vibrate {
+private:
+	constexpr static unsigned int motorPin = 27;
+	constexpr static unsigned int pulseDuration = 200;
+
+public:
+	inline static void begin(void) {
+		pinMode(motorPin, OUTPUT);
+		digitalWrite(motorPin, false);
+	}
+
+	inline static void pulse(void) {
+		digitalWrite(motorPin, true);
+		delay(pulseDuration);
+		digitalWrite(motorPin, false);
+	}
+};
+
+#endif // VIBRATE_HPP_
-- 
cgit v1.2.3