We synthesized a new fluorescent probe 1O by attaching a diarylethene molecule to a functional group. The probe can be used to detect Al 3+ and Zn 2+ at the same time with high selectivity, and its detection limit is very low. When Al 3+ was added, the fluorescence intensity was increased 310 folds, and was accompanied by a fluorescent color change from black to grass-green. Similarly, after the addition of Zn 2+ , the fluorescence intensity was enhanced 110 folds, with a concomitant color change from black to yellowgreen. Moreover, based on the properties of 1O, we designed a logic circuit, and that also can be used for water sample testing.