A somewhat silly project that uses an LPC11U24 to control the system, a Neopixel stick to provide light, and a sound FX board with a small speaker to make noise. I set the pins to inputs with pull-ups then connected 14 jumper wires to ground. Every time a wire was disconnected, the system changed its lighting pattern: color, blink timing, blink pattern (blink to white, black, random, or opposite the main color). The system also played a random audio clip. More details on http://embedded.fm/blog/2016/5/24/fistful-of-wires License: CC-A-NC
Diff: BuzzMotor.h
- Revision:
- 1:0a051df78be2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BuzzMotor.h Wed May 25 03:42:25 2016 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +// new class to play a pattern based on PwmOut class, based on SongPlayer: SongPlayer +// https://developer.mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/ +class BuzzMotor +{ +public: + BuzzMotor(PinName pin) : mPin(pin) { + // mPin(pin) means pass pin to the constructor + mPin = 0.0; + } + void On() + { + mPin = 1; + } + void Off() + { + mPin = 0; + } + +private: + Timeout duration; + DigitalOut mPin; + typedef enum {RUMBLE=0, ONE_SEC_HIGH_TICK=1, ONE_SEC_LOW_TICK=2, QUIET=3 } eBuzzType; + +};