Simple hal sensor on/off program

I want a simple on/off programming for 8951.Please guide me to program.

More questions in this forum