This is a Useless Box that flips multiple switches instead of just one. It uses a stepper motor & A4988 driver to move the arm, and two servos - one for the arm, and one for the lid.
The box is controlled by an ATMEGA328P.
In Action:
https://i.imgur.com/oVlNI0r.mp4
Code:
https://github.com/coffeman500/UselessBox/blob/master/useless_box_arduino.ino
Schematic:
https://easyeda.com/coffeman500/useless-box
Parts:
Summary:
The program uses switch interrupts to watch the 3 switches. When flipped the interrupt fires (Line 62-117) and adds any switched pins to the linked list (Line 37-44).
The main loop then watches the linked list, and goes to turn off any nodes added as they appear, moving down the list as necessary (159-176).
There's also a fallback method to just hit any switches that are HIGH in case the linked list fails to capture a trigger (179-192).
When the program becomes idle (no switches are available to hit) it resets back to a default state by moving the platform all the way left until the lever switch (Home Switch) is hit, and resetting the arm & lid (Door) servo positions (245-274).