Need advice with first project

Hello all,

I am Ernie and have just today joined this site. I am working on a very simple device and would like some help.

I am trying to control my digital camera with a Ping distance sensor, so that when the sensor detects a certain distance, say 12 inches, the solenoid motor activates, thereby releasing the shutter and taking a picture.

This is what I have:

Arduino UNO R3

solenoid motor 5vsainsmart HC-SR04 ranging detector mod distance sensor

I can control the motor, and I can control the sensor, both my cutting and pasting code online. However, I am trying to figure out how to make the motor act when the sensor detects a certain distance. If someone could point me in the direction of code I can try out, it would be fantastic. Thanks in advance,

Ernie