Hello,
I want to test that I can switch the LGB Turnout with an Arduino and a motor driver L298N. this is just a test but for the moment it is a fail. With a DC motor everything is ok but when I wire the LGB Turnout to the L298N I am hearing a kind of whistle like a ultrasound. This is a LGB 12010 turnout motor 14V-20V.
Does somebody has a idea? Thanks
const int motor1pin1 = 2;
const int motor1pin2 = 3;
const int enablePin=9;
void setup() {
// put your setup code here, to run once:
pinMode(motor1pin1, OUTPUT);
pinMode(motor1pin2, OUTPUT);
//(Optional)
pinMode(9, OUTPUT);
//(Optional)
digitalWrite(enablePin,LOW);
}
void loop() {
// put your main code here, to run repeatedly:
//Controlling speed (0 = off and 255 = max speed):
//(Optional)
analogWrite(enablePin,100); //ENA pin
//(Optional)
digitalWrite(motor1pin1, HIGH);
digitalWrite(motor1pin2, LOW);
delay(110);
digitalWrite(motor1pin1, LOW);
digitalWrite(motor1pin2, LOW);
delay(5000);
digitalWrite(motor1pin1, LOW);
digitalWrite(motor1pin2, HIGH);
delay(110);
digitalWrite(motor1pin1, LOW);
digitalWrite(motor1pin2, LOW);
delay(10000);
}