This is Ultrasonic Sensor test with Raspberry Pi2
System Settings Sensor : HC-SR04 TrigPin Setting : 8 EchoPin Setting : 9
Program is should be executed as sudo (root)
Notice: when you work with Rpi in remote control environment (like tightvnc), The vncserver should be runned as sudo -> sudo vncserver :1 after using sudo for vncserver, the new environment setting should be done as a root