Music Box? is a box but it doesn’t play any music. Instead, it controls how the music is played on your laptop with static states and actions.
Whenever the box is put on the table, the face facing up indicates the current state of the music. For example, the first photo shows that the music state is stop. The four states are play, speed up, stop and pause in order so that play is next to speed up and pause while oppose to stop. If the user want to skip a state, for example, stop the music directly while it is playing, he just needs to turn the box really fast because it takes half a second for the device to operate.
Skip back and skip ahead are two actions that can be achieved by lifting right or left side of the device. The pyramid-shape decorations on the side form two arrows pointing left or right on the side view that match the skip back and ahead actions.
Turning the Music Box? around for 360 degree to play a random song. I thought about the action for a long time in order to decide on one action that fits the feeling of randomness. I feel like turning around can be something interesting since you can never make two exactly the same turnings.
Compared with the beginning of this class, I enjoy making enclosures much more now!
Problems on the way
- Calibration: the default value is getting smaller because of the decreasing of battery power
- Serial Communication: Arduino Pro Micro uses USB communication so if I need to use Serial communication, I need to write Serial1 instead of Serial
- analogReference(EXTERNAL): connect accelerometer with REFE pin in Arduino to give it a voltage reference
Calibration code is credit to Adafruit
add calibration procedure to the device. Make the threshold proportional to the calibration value instead of hard code value
tom also suggested to add a condition to read the accelerometer value. For example, only if the user touches a certain area, can the accelerometer be read by Arduino. Otherwise, the loop() function does nothing. In this way, it can avoid some random movements.