diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2019-03-30 17:17:58 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2019-03-30 17:17:58 -0400 |
commit | 230f0cb2914b02c4d70b19ac4358f2a0a078a676 (patch) | |
tree | 0857434674916a0bc7052d7b675de2ff215aeb6e /source/vibrate.hpp | |
parent | 955993dcb2f744b9ccb39c05d058149cb071d7a5 (diff) |
better scrolling, vibration
Diffstat (limited to 'source/vibrate.hpp')
-rw-r--r-- | source/vibrate.hpp | 42 |
1 files changed, 42 insertions, 0 deletions
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_ |