Using Drosophila melanogaster (fruit fly) as a model organism has ensured significant progress in many areas of biological science, from cellular organization and genomic investigations to behavioral studies. Due to the accumulated scientific knowledge, in recent years, Drosophila was brought to the field of modeling human diseases, including heart disorders. The presented work describes the experimental system for monitoring and manipulating the heart function in the context of a whole live organism using red light (617 nm) and without invasive procedures. Control over the heart was achieved using optogenetic tools. Optogenetics combines the expression of light-sensitive transgenic opsins and their optical activation to regulate the biological tissue of interest. In this work, a custom integrated optical coherence tomography (OCT) imaging and optogenetic stimulation system was used to visualize and modulate the functioning D. melanogaster heart at the 3rd instar larval and early pupal developmental stages. The UAS/GAL4 dual genetic system was employed to express halorhodopsin (eNpHR2.0) and red-shifted channelrhodopsin (ReaChR), specifically in the fly heart. Details on preparing D. melanogaster for live OCT imaging and optogenetic pacing are provided. A lab-developed integration software processed the imaging data to create visual presentations and quantitative characteristics of Drosophila heart function. The results demonstrate the feasibility of initiating cardiac arrest and bradycardia caused by eNpHR2.0 activation and performing heart pacing upon ReaChR activation.