Help how to Control Solenoid...

androidfanboy:
From the code it is used to change the speed of the motor, but in normal motor driver convention the "EN" pin changes direction, and the "PWM" pin changes speed.

my circuit is only controlling a 12v solenoid door lock , do i need those codes?

No, you're not controlling speed, only on/off.

androidfanboy:
No, you're not controlling speed, only on/off.

so my code will be like this now?

}
void openDoor(){
   digitalWrite(solenoidPin, LOW);
}
void closeDoor(){
   digitalWrite(solenoidPin, HIGH);
}

Yea something like that.

I really appreciated your help sir, know my solenoid can be controlled without kick backs :slight_smile: Thanks for the help my problem is solve :slight_smile:

Wawa:
androidfanboy told you in post#1 to "delete all the motor commands in your code and set a digital pin to OUTPUT for controlling the solenoid."

YOU mentioned pin13 in post#7.

I get the impression that you don't know what you're doing, and are just copying code that you don't understand.
Maybe because you skipped the simple learning stuff.

I suggest you put it all aside, and go through some of the basic examples that come with the IDE.
Then you will understand how to name a pin, and make it an output.

const byte solenoidPin = 12; // pin for solenoid transistor

void setup() {
  pinMode(solenoidPin, OUTPUT); // make the solenoid pin an output
}


Leo..

Thanks for the help sir so appreciated. The project is now functional.