int bin2dec(char* bin) { int i, out = 0; for(i=7;i>=0;i--) { if(bin[i]=='1') { out += pow(2, (7-i)); } } return out; }