Code to take a picture