We present an optoelectrical device capable of in vitro optical stimulation and electrophysiological recording. The device consists of an array of micropixellated InGaN light-emitting diodes coupled to a custom-made ultrathin planar microelectrode array. Cells can be cultured directly on the chip for short- and long-term electrophysiological experiments. To show the functionality of the device, we transfected a cardiomyocyte-like cell line (HL-1) with a light-sensitive protein channelrhodopsin. We monitored action potentials of individual, spontaneously beating, HL-1 cells growing on the chip by extracellular electrical recordings. On-chip optical stimulation was demonstrated by triggering network activity in a confluent HL-1 cell culture and visualized by calcium imaging. We see the potential of our system for electrophysiological experiments with optogenetically modified cells. Optical stimulation can be performed directly on the chip without additional optical components or external light sources.