char* to byte

Ahh - cool, I'm assuming you are using the USB libraries from here?

Going by that assumption, the KEY_ is a macro definition that gets replaced when the code complies, so you won't really be able to generate it on the fly like that.

The good news is you can still 'hack' your way to it, this example assumes you are using the above mentioned library

void usbsend(char* str, int len)
{
	for(int num=0;num<len;++num)
	{
		if(str[num] == '.')
		{
			UsbKeyboard.sendKeyStroke(55);
		}
		else
		{
			// We grab the current character, which is a byte/char
			byte val = str[num];
			
			// Now looking at the #define macros in UsbKeyboard.h we can see 
			// that the letters range from 4-29 and numbers are from 30-39.
			// 
			// The characters in the string are (most probably) in ASCII format, so we can do things like this
			// All we are doing is offsetting the ascii value so it matches up with the key stroke value
			
			// Convert capitals into keystroke
			// Could probably replace the numbers with the character literals ('A')
			if (val >= 65 && val <= 90)
				val -= 61;
			else if (val >= 97 && val <= 122) // lowercase
				val -= 93;
			else if (val >= 48 && val <= 57)
			{
				// Numbers, but they are 'tricky' since they're in a different order
				if(val == 48) // 0
					val = 39;
				else
					val -= 19;
			}

			UsbKeyboard.sendKeyStroke(val);
		}
	}
}

This should do the trick, can't really test it atm as I'm at work - but that's an idea to do what you're wanting to do :slight_smile: