Kyo,
If you use N-channel FET, my suggested circuit could work ( might not be the best : ). You need to make a real circuit to test it since I haven't tested it .
Yet I think it's better to use a P-channel FET if you haven't bought any FETs.
In your circuit, R1 should be 10 Ohm (not 10K), also the 10K resistor (R2) connected to the drain terminal of the FET may better be replaced by a flywheel diode such as 1N4001.
Yes, you can use the code without any change for both circuits.
regards
If you use N-channel FET, my suggested circuit could work ( might not be the best : ). You need to make a real circuit to test it since I haven't tested it .
Yet I think it's better to use a P-channel FET if you haven't bought any FETs.
In your circuit, R1 should be 10 Ohm (not 10K), also the 10K resistor (R2) connected to the drain terminal of the FET may better be replaced by a flywheel diode such as 1N4001.
Yes, you can use the code without any change for both circuits.
regards