Just update the script like
var m=null;
automatic=function(){
clearInterval(m);
m = setInterval(function(){
if(i == myArray.length-1)
{i=0;}
else
{i=i+1;}
document.getElementById("placeDiv1").style.backgroundColor = myArray1[i];
document.getElementById("placeDiv").style.backgroundColor = myArray[i];
},100);
stop=function(){
clearInterval(m);
};
Check Fiddle
You need to Kill the setinterval when you call the function automatic
and also need to define var m
outside the function