Optogenetics is an innovative method for precise control of biological function, which makes light manipulation displays more advantages than electric energy because of contactless spatial flexibility and cell-to-cell synchronous communication. The aim of this study was to perform different illumination modes with blue laser to investigate optical control of the mice hearts. In this study, we transfected the light sensitive protein ChR2(H134R) into mouse hearts, which were illuminated with a 473 nm laser on the Langendorff apparatus. We recorded all the signals of electrograms (EGs), epicardium monophasic action potential (MAPs) and light output signals to analyze myocardial electrical activity. EGs and MAP showed that ChR2 expression in the heart can be flexibly controlled by blue light across different illumination sites with corresponding triggered ectopic rhythm. Illumination intensity, pulse duration, and impulse frequency were associated with the light capture rate. Continuous illumination with the threshold intensity on the left ventricle had little influence on sinus rhythm and ventricular electrophysiology. Our results support that flexible control of the cardiac rhythm with optogenetics provides an innovative approach to cardiac research and therapy.