You could use 3dcalc with relative indexing on pseudo-time as in this example below. The result shows 1 when switching from 1 to 0, -1 when switching from 0 to 1. You can easily change this to the reverse, or use an equals operator to only test for equality between a and b.
% more test.1D
1
0
0
0
1
1
0
0
1
% 3dcalc -a test.1D\' -b 'a+l' -expr 'a-b' -prefix testout.1D
++ 3dcalc: AFNI version=AFNI_2008_02_01_1144 (Mar 27 2008) [32-bit]
++ Authored by: A cast of thousands
% more testout.1D
1
0
0
-1
0
1
0
-1
0