void setup() {
volatile char *dirf, *dirk;
dirf = 0x30;
*dirf = 0x03;
dirk = 0x107;
*dirk = 0x03;
}
void loop() {
volatile char *outf, *outk; //both the ports are output port
volatile long i;
outf = 0x31;
outk = 0x108;;
*outk = 0x00;
*outf = 0x01; //LED 2,4
for (i = 0; i < 500000; i++);
*outk = 0x00;
*outf = 0x02; //LED 1,3
for (i = 0; i < 500000; i++);
}