Hex inputs from 4x4 keypads and extracting numbers from strings

I was designing a project that would encrypt a message using a stored key and transmit it, using Arduino Mega 2560's, nRF24L01's, and 4x4 keypads. I listed the steps the Arduinos would make:

.1. ARDUINO_01 OPENS RF WRITING PIPE
2. ARDUINO_02 BEGINS RF LISTENING
3. USER INPUTS MESSAGE IN HEX FORMAT TO ARDUINO_01
4. ARDUINO_01 DISPLAYS MESSAGE ON LCD SCREEN
5. ARDUINO_01 RANDOMLY SELECTS ONE FROM 50 PRESET KEYS
6. ARDUINO_01 ENCRYPTS WITH SELECTED KEY USING VIGNERE’S CIPHER
7. ARDUINO_01 APPENDS KEY SERIAL NUMBER TO ENCRYPTED MESSAGE
8. ARDUINO_01 WRITES MESSAGE OVER WRITING PIPE
9. ARDUINO_02 RECIEVES MESSAGE
10. ARDUINO_01 BEGINS RF LISTENING
11. ARDUINO_02 EXTRACTS SERIAL NUMBER OF KEY FROM MESSAGE
12. ARDUINO_02 PERFORMS REVERSE VIGNERE’S CIPHER ON MESSAGE USING KEY
13. ARDUINO_02 DISPLAYS DECRYPTED MESSAGE ON LCD
14. ARDUINO_02 OPENS RF WRITING PIPE

I'm unsure of how to approach two problems. How do I read characters in hex format from a keypad, and how do I pull the key number from the transmitted string?

Any advice would be appreciated.

Take a look at Keypad data entry. A beginners guide - Introductory Tutorials - Arduino Forum as a start point

Thank you very much, that was a very informative and well written post.

I've just realized that I don't need to use hex. I could just use decimal values and cast them to char.

The second issue remains though, but I might have a solution to that: I could just use delay(), wait for 1 second and then transmit the key separately.

What format do you envisage the transmitted string being in ?
Do you have control of the format and can you please post an example of what the data will look like ? Will the number always be the same length and in the same place in the string ?

I was thinking of transmitting the message as:

radio.write(&message,strlen(message) );

and receiving it as:

int len=0;
char messageRecieved[]="";
len = radio.getDynamicPayloadSize();
radio.read( &messageRecieved, len );

The number will also be of the same size each time, as I'll be transmitting an integer.

I was interested in what you were transmitting rather than how you were transmitting it

Take a look at Serial input basics - updated

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.