I capture my keypad char like this:
char key = keypad.getKey();
but then my virtual wire library wants me to send stuff like this:
const char *msg = "hello";
vw_send((uint8_t *)msg, strlen(msg));
I'm getting this error: error: invalid conversion from 'char' to 'const char*'
How can I cast the char into uint8_t?
Thanks!
This worked for me on a remote control. I
// go read the keypad
char key = keypad.getKey(); // reading the keypad
if(key) // same as if(key != NO_KEY)- did something change?
{
msg[0]=key; // load the array with the key character
// msg[1]=NULL; // Rx side seems to work without this
digitalWrite(ledPin, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg, strlen(msg)); // send the character out
// Serial.println(key); // for debugging only
vw_wait_tx(); // Wait until the whole message is gone
delay (50); // need some delay or seem to miss key presses
digitalWrite(ledPin, false); // turn off the flash of LED
} // end of if(key) & transmitting a character
This works perfectly, thanks!
At some point I'm going to have to brush up on my C data types...