Electrosynthesis of organic–inorganic compounds (p–n heterojunction)