I am attempting to build a keypad decoder, a wireless transmitter, a receiver and a 3inch LED display.
The decoder is working but I am having trouble determining what type data to transmit ie. character, byte or integer.
Since I will have to decode the data at the receiver, what would be the best type to use?
The initial code is;
#include <Keypad.h>
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[ROWS] = { 9, 8, 7, 6 }; // keypad rows to Arduino pins
byte colPins[COLS] = { 12, 11, 10 }; //keypad columns to Arduino pins
// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
#define ledpin 13 //define output pin to xmitter
void setup()
{
pinMode(ledpin,OUTPUT); //for testing
digitalWrite(ledpin, HIGH); //for testing
Serial.begin(9600);
}
void loop()
{
//for (int(c); c <2; c++); I would like to accumulate three bytes and transmit together if possible
char key = kpd.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
case '#': //Clear data for re-entry
digitalWrite(ledpin, HIGH); // for testing
break; // for testing
case '*': // Display data on receiver
digitalWrite(ledpin, LOW); // for testing
break; // for testing
default: //send data to xmitter not working! It only sends to! computer display.
Serial.println(key); // for testing
}
}
}
All help would be greatly appreciated. This is a project for our church.
Thanks
Bill