An ophthalmic stimulator for temporarily constricting a pupil of an eye comprises a digital beam controller, to generate a digital beam-control signal a light source, coupled to the beam controller, to generate a light beam and a digitally controlled beam modulator, to receive the digital beam-control signal from the beam controller, to receive the light beam from the light source, and to modulate the received light beam into a patterned light, delivered to an iris of the eye wherein the beam controller controls at least one of the light source and the digitally controlled beam modulator with the digital beam-control signal so that the patterned light causes a temporary constriction of the pupil of the eye, without causing a permanent constriction of the pupil.