HI,
I recall an app that used the camera to detect movement.
Depending on the phone you may be able to sense light levels.
There is a video on using DS to control a device that can be connected to lights etc.
There are examples of using Espruino, Espruino, Nxt, Banana PI, etc
Regards, ah