Problems integrating Reed Switch and Solenoid Lock in Arduino Code
The problem is, that you don't initiate the LED's pin to an output. On reset the pin is configured as input. Doing a digitalWrite(led_pin, HIGH) in this state just enables the internal pullup resistor. If you measure the voltage without the LED connected, it will be 5V, but since the pin only provides a very small amount of current through the pullup resistor, the LED cannot light up when connected.

You need to configure the LED's pin as an output through

pinMode(led_pin, OUTPUT);


in your setup() function.

So actually the beginTransaction() function was correctly executed. You just couldn't see it.