I need to convert unsigned char buttons[8] to either
1) binary
2) hex
3) decimal
Any ideas?
Code: Select all
unsigned char buttons[8] = {'1','0','0','1','1','1','0','1'};
// send as binary
usb_write_buffer[0] = 0b10011101;
// send as hex
usb_write_buffer[1] = 0x9D;
// send as decimal
usb_write_buffer[2] = 240;
while(!HID_Write(&usb_write_buffer,3));
Decimal = 240
Hex = 0x9D