void setup() {
// put your setup code here, to run once:
volatile char *dirf, *dirk;
volatile long i,j,x;
dirf = 0x30;
*dirf = 0x00;
dirk = 0x107;
*dirk = 0x03;
volatile char *inf,*outk;
inf = 0x2f; outk = 0x108;
i=0;
while(1)
{
x=*inf;
if((x & 0x01) == 0x01)
{
i++;
for (j=0; j<200000; j++);
//while ((x & 0x01) == 1);
}
if (i%2)
*outk = 0x01;
else
*outk = 0x02;
}
}
void loop() {
// put your main code here, to run repeatedly:
}