color[] firstframe;
color[] secondframe;
int i= 1;
int x;
int y;
void draw(){
firstframe[i]=get(x,y);
delay(500);
secondframe[i]=get(x,y);
if (firstframe[i]==secondframe[i]){
i++;
y++;
if(y==1920){x++; y=1;}
}
if(firstframe[i]!=secondframe[i]{
print("motion detected");}
}
Hi! It would be great if you can add text to describe what you want to do. What do you mean by motion sensor? Is it a camera? Which platform are you using?
- you would have to add video feed to the program and then it looks for changes in the image, often motion. hense motion sensor
- this is processing.org
- read guidelines