New unsymmetrical diarylethenes were synthesized and their photochromic and fluorescent properties are tailored by Cu2+ and CNâ coordinations. A novel molecular logic keypad lock is constructed based on the fluorescence emission changes by the inputs of UV/visible irradiation, Cu2+ and CNâ.