void setup() {
// put your setup code here, to run once:
volatile char i,j;
volatile char *dirf,*dirk,X;
volatile char *outf,*ink;
dirf = 0x30,dirk = 0x107;
outf = 0x31 ,ink = 0x106;
*dirf = 0x01,*dirk = 0x00;
i=0; // sestting as output
while(1){
X = *ink;
if((X & 0x01) == 0x01){
i++;
for(j=0;j<50000;j++);
}
if(i%2)
*outf = 0x01;
else
*outf = 0x02;
}
}
void loop() {
// put your main code here, to run repeatedly:
}