I want to create a motion sensor. Basically, if the iphone camera detects motion, a command will happen. To create a motion sensor in the simplest way possible, I want to make the iphone take a picture every second. Then, I want the iphone to compare the newest picture with the picture that was taken before to see if they are the same. If the pictures are the same, nothing happens (because no motion was detected). If the pictures is different, then the command will happen (because motion was detected).
In essence, I need the iphone taking a picture every second and then compare the newest picture with the previous one to see if they are identical or not.
Any help would be appreciated, thank you