Introduction: LittleBits Arduino Annoying Machine
This is a fun little machine my son and I built with littleBits. Built around the littleBits Arduino, this machine sounds the buzzer at random intervals, requiring the annoyed person press the button at random times. It's a nice little prototype of a snooze function on an alarm clock that prevents over sleeping.
Step 1: Needed Parts
This contraption needs these littleBits parts:
- p1 - Power to run the machine.
- Or any power module that can power these parts
- i3 - Button to turn off the buzzer.
- Many other input modules could be used, but may need minor code changes.
- o3 - RGB LED indicate the machine is on.
- Or any output device to indicate the machine is running.
- o6 - Buzzer to annoy the victim.
- Or any other output such as the servo attached to an actuator that tickles the victim.
- w1 - Wire to connect the output to the button.
- Multiple wires can extend the button further away form the machine.
- w6 - Arduino module
Step 2: Connecting the LittleBits
This machine is built around the Arduino module. Make these littleBits connections:
- Connect the power to a0 or a1 (shown) on Arduino Bit
- Connect the wire to d0 on the Arduino
- Connect the button to d9 on the Arduino
- Connect the loose end of the wire to the button
- Connect the LED to d5 on the Arduino
- Connect the buzzer to d1 Arduino
Now your device is ready for programming.
Step 3: The Code
Attached is the code for this machine.
The code sets up the input and output on the Arduino. It sets up the input and output of the pins on the Arduino, including outputting power on d9 to run the switch.
The loop function counts the number of times through the loop, keeping track for both the LED and the buzzer.
The LED has a short time out, and turns on or off the LED when the counter has reached the set number of times through the loop. The code just flips the light on or off and starts counting again. This makes the LED a flashing indicator, showing that the machine is running.
The code for the buzzer is similar to the LED code, with two significant differences. One, the counter limit is set randomly, so the counter will take different times. Two, when turned on, the buzzer will stop counting, and just stay on until the Arduino senses that the button was pressed.
Step 4: Run the Machine
Load this code from your computer to your Arduino module, and turn on the machine.
The machine will start blinking the LED to indicate that it is still running. After a random time, the buzzer will sound. Press the button, and that buzzer will turn off, but only for a limited random time.
We have a be nice policy.
Please be positive and constructive.