Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int switchPin = 2; //
- const int motorPin = 9; //
- int switchState = 0; //
- void setup() {
- pinMode(motorPin, OUTPUT); //
- pinMode(switchPin, INPUT); //
- } void loop() {
- switchState = digitalRead(switchPin); //
- if (switchState == HIGH) { //
- digitalWrite(motorPin, HIGH); //
- } else {
- digitalWrite(motorPin, LOW); //
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement