Module 3: Controlling a Solenoid
When they are turned on, the electromagnet pulls the metal rod through the coil. When they are turned off, the spring returns the metal rod to its original position.
Start by inserting the pin adapter into the motor controller. Pull back on the orange tabs and press the pin adapter in firmly.
Since the solenoid only operates in one direction, MA2 is not needed. With the pin adapter installed, use jumper wires to connect the solenoid to MA1 and the closest ground (GND). Set Analog Pin 5 to 255 to ensure the solenoid has enough power. Digital Pin 3 can then be used to turn the solenoid on and off. (Note: For the solenoid to activate, slight pressure must be applied to the end with the spring on it.)
To create a drum hit, turn the solenoid on, wait, and then turn it off again. Since the drum hit is an impulse, the wait should be as short as possible.