unsigned char O;
unsigned char K;
unsigned char IP[12];
unsigned char HTTP[20];
int i,j;
while (1)
{
lcd_puts("welcome");delay_ms(200);lcd_clear();
delay_ms(6000);
putsf("AT\r");
while(getchar()!='\r'); while(getchar()!='\n');
O=getchar();K=getchar();
lcd_gotoxy(0,0); lcd_putchar(O);lcd_putchar(K);delay_ms(2000);//u can put away this delay. I put this delay because if i put it away, the screen is to fast. It just for testing.
reload:
while(getchar()!='\n');
putsf("AT+CGATT=1\r");
while(getchar()!='\r');while(getchar()!='\n');
O=getchar();K=getchar();
lcd_clear();lcd_gotoxy(0,1); lcd_putchar(O);lcd_putchar(K);delay_ms(2000);
if(O!='O' && K!='K') goto reload;
while(getchar()!='\n');
puts("AT+CSTT=\"telkomsel\",\"wap\",\"wap123\"\r");
while(getchar()!='\r');while(getchar()!='\n');
O=getchar();K=getchar();
lcd_clear();lcd_gotoxy(0,0); lcd_putchar(O);lcd_putchar(K);delay_ms(2000);
if(O!='O' && K!='K') goto reload;
while(getchar()!='\n');
puts("AT+CIICR\r");
while(getchar()!='\r');while(getchar()!='\n');
O=getchar();K=getchar();
lcd_clear();lcd_gotoxy(0,1); lcd_putchar(O);lcd_putchar(K);delay_ms(2000);
if(O!='O' && K!='K') goto reload;
while(getchar()!='\n');
puts("AT+CIFSR\r");
while(getchar()!='\r');while(getchar()!='\n');
for(i=0;i<13;i++){IP[i]=getchar();}
lcd_clear();lcd_gotoxy(0,1); lcd_puts(IP);delay_ms(2000);
if(IP[0]=='E' && IP[1]=='R') goto reload;
while(1);
}