话不多说,直接上码。
NSString*string = [[NSStringalloc]initWithFormat:@"%@",_StartLabel.text];
NSArray*timeComs = [stringcomponentsSeparatedByString:@":"];
Bytehour_byte = (Byte)[timeComs.firstObjectintValue];
Bytemin_byte = (Byte)[timeComs.lastObjectintValue];
NSDate*currentDate = [NSDatedate];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormattersetDateFormat:@"HH:mm"];
NSString*dateString = [dateFormatterstringFromDate:currentDate];
NSArray* currenttime = [dateStringcomponentsSeparatedByString:@":"];
Bytecurrent_hour = (Byte)[currenttime.firstObjectintValue];
Bytecurrent_min = (Byte)[currenttime.lastObjectintValue];
ByteB ={01+02+01+hour_byte+min_byte+01+current_hour+current_min};
Bytesum = ~B+1;
NSLog(@" %d",B);
NSLog(@" %hhu",sum);
Bytetable[] = {0xFD,0xFA,0x01,0x02,0x01,hour_byte,min_byte,0X01,0x00,0x00, current_hour,current_min,0x00, sum,0xFD,0xFA};
for(intj =0; j
NSLog(@"%02x", table[j]);
}