Close
0%
0%

OPEN-SMART Electromagnet

Open-smart electromagnet operated with push button.

Similar projects worth following
180 views
0 followers
const int buttonPin = 4; const int magnetPin = 5; int buttonState = 0; int lastButtonState = 0; bool magnetState = false; void setup() { pinMode(buttonPin, INPUT_PULLUP); pinMode(magnetPin, OUTPUT); digitalWrite(magnetPin, LOW); } void loop() { buttonState = digitalRead(buttonPin); if (buttonState == LOW && lastButtonState == HIGH) { delay(50); magnetState = !magnetState; if (magnetState) { digitalWrite(magnetPin, HIGH); } else { digitalWrite(magnetPin, LOW); }} lastButtonState = buttonState; }

electro_magneet_button.ino

x-arduino - 510.00 bytes - 10/05/2024 at 08:52

Download

  • 1 × ky-004
  • 1 × Open-smart electromagnet
  • 1 × Aduino Uno

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates