Pair of Solenoids on a L298N and Elegoo UNO R3

First off I want to apologize for asking this since it seems so simple I hate to waste anyones time but I can’t seem to get my Elegoo to recognize a second int entry/setting. How do I get the Elegoo to save my second int entry?

I am working on a project for a friend. This project alternates between energizing solenoid number one for one second then releases it, then energizes solenoid number two then releases it, then repeats the process and loops back to energize solenoid one then two etc. Constantly energizing one then the other solenoid. Currently the setup only energizes the first int entry. To troubleshoot I moved the wire from pin 12 on the Elegoo to pin 9 on the L298N which energized that solenoid which bring me back to pin 13 on the Elegoo not being activated.

The parts I am using are:
Elegoo UNO R3
(2)Uxcell a14092600ux0438 Open Frame Actuator Linear Mini Push Pull Solenoid Electromagnet, DC 4.5V, 40 g/2 mm

The Elegoo gets its power from the 5V connection on the L298N
The L298N gets its power from a 9V dc battery
The Elegoo is connected to the L298N using pins 12 and 13 on the Digital PWM connector leading to the L298N pins 8 and 9 respectively
Jumpers are on pin 7 and 12 on the L298N
Solenoids hot wires on connections 1 and 2 of L298N
Solenoids grounded to connection 5 (dc input ground) on L298N

Here is my sketch:

//Project: To control 2 solenoids with Elegoo UNO R3 and L298N
//doesn’t save the second int entry

int solenoidPin = 12; //This is the output for 1st solenoid
int solenoidPin2 = 13; //This is the output for 2nd solenoid

void setup()
pinMode(solenoidPin, OUTPUT); //Sets that pin as an output
pinMode(solenoidPin2, OUTPUT); //Sets that pin as an output

void loop()

digitalWrite(solenoidPin, HIGH); //Switches 1st Solenoid ON
delay(1000); //Wait 1 Second
digitalWrite(solenoidPin, LOW); //Switches 1st Solenoid OFF
delay(1000); //Wait 1 Second

digitalWrite(solenoidPin2, HIGH); //Switches 2nd Solenoid ON
delay(1000); //Wait 1 Second
digitalWrite(solenoidPin2, LOW); //Switches 2nd Solenoid OFF
delay(1000); //Wait 1 Second

I am attaching pics of my setup. Again, I apologize for asking such a simple question, or maybe it is complicated and I am making it too simple.

Here's OP's pics:

If I read that right, the non-working solenoid worked when you triggered it from the working one's Uno pin. That was a good test.

You could have gone one step further, and changed the code and wiring to use say pin 11 instead of 13. If that works, you're sorted.

(Except for not knowing why 13's not working and I'm wondering if that's to do with the built-in led and not having high enough voltage at the pin itself, to be seen as high by the 298. But try 11 or something first, and if that works worry about 13 later.)

edit: Just check voltage on pin 13 of my genuine Arduin Uno and it's just under 5V so not a problem with mine, anyway.

Can you provide a drawing if the circuit: I'm not seeing any ground between the Uno and the 298 module, nor am I seeing 5V on the 298 enable pin. (In which case I'm surprised that one of the outputs is working at all...)

(What do the jumpers you mention do?- do they put 5V on the 298's enable pins? What you have is of course a 298 module, not a raw 298, and we don't all know the specifics of the module, which is an implementation of a well known chip, but it's not just the chip.)

Another thought: I've never used a 298 for solenoids, only 2x motors, and in the case of motors one uses "both channels"of the 298, one per motor. That needs 4x wires, a H/L or L/H on each side.

Looks to me that you have both solenoids on one channel, with one side of the solenoids grounded, and each relying on a H output to energise one solenoid or the other.

I suppose that should work, although I'd have gone for using both sides, and explicitly controlling both sides of each solenoid.

Also if your 9V battery is a PP3 smoke alarm battery, they have neither the current not the capacity for what you're doing.