A novel fluorescent probe that possess both BODIPY and Rhodamine moieties has been designed for the selective detection of Hg(2+) and Ba(2+) ions on the controlling by a logic gate. The characteristic fluorescence of the Ba(2+)-selective OFF-ON and the Hg(2+)-selective fluorescence bathochromic shift can be observed, and the concept has been used to construct a combinational logic circuit at the molecular level. These results will be useful for further molecular design to mimic the function of the complex logic gates on controlling.