void setup() {
volatile char *dir=0x30;
volatile char *outf=0x31;
volatile char x;
volatile long i,j;
volatile char *inputk=0x106;
*dir=0xff;
dir=0x107;
*dir=0x00;
i=0;
while(1)
{
x=*inputk;
if(x&0x01==0x01){
i++;
for(j=0;j<100000;j++);
}
if(i%2==0)
*outf=1;
else
*outf=2;
}
}
void loop() {
// put your main code here, to run repeatedly:
}