In this paper, experimental results show that both NOR and NAND logic gates are mutually switched by changing the wavelength detuning based on the self-locked single-mode Fabry-Perot laser diode (SMFP-LD), when the total power of input signals is fixed at -4 dBm with bias current of 12 mA and operation temperature of 12.6 degrees C for laser diode. The NOR logic gate is performed with wavelength detuning of less than 0.09 nm, which is switched to NAND logic operation when the wavelength detuning ranges from 0.09 nm to 0.16 nm. In addition, the corresponding 3-input NAND logic gate is also proposed and demonstrated under the condition of wavelength detuning of 0.12 nm. The achieved On/Off constant ratio (logic "1" to logic "0") at the dominated mode reaches up to similar to 35 dB. (C) 2013 Elsevier B.V. All rights reserved.