The Arduino Projects Book includes "15 Hacking Buttons". I dislike this project for multiple reasons:

  • It involves potential destruction of home appliances. From the project:

"You’ll be opening up an electronic device and modifying it. You’ll void your device’s warranty, and if you’re not careful, you might damage the device....We recommend you use inexpensive items you don’t mind damaging for your first few projects, until you develop experience and confidence."

  • I tried many permutations of this project without success. In every case, once the optocoupler (I used MOC3021) gets activated, it remains permanently activated even when the sketch executes digitalWrite(optoPin, LOW)...even when I physically disconnect the anode of the optocoupler from the Arduino UNO pin.

Therefore, I created a series of projects that teach the same optocoupler concepts in a simpler way. Moreover, these projects also teach Triacs. Anyone can download the files for these projects here: p15_HackingButtons.zip

**These projects use high-voltage electricity from a home outlet. If you do not have previous experience with high-voltage circuits, you should probably avoid these projects. **

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

It's right there in the quote you provide from the book:

It's 2021. Most people have plenty of cheap electronics lying around that they have no use for. If not, there is plenty to be scavenged, bought from thrift stores or even purchased new for insignificant sums. If some of those things are destroyed for the cause of inspiring people to learn about embedded systems, I'll consider that OK.

I learned a lot and had a lot of fun as a kid dragging home random devices I found in a trash can, taking them apart, and playing around with the parts.