i want to send values greater than 255 form arduino mega to arduino uno but it did not sent.
i use serial communication , i2c for this
what to do , here is my code for sender(mega) and receiver(uno)
// for sender(mega)
#include <SoftwareSerial.h>
#include <Keypad.h>
SoftwareSerial mySerial(2, 3); //rx, tx
const byte ROWS = 5; // four rows
const byte COLS = 5; // three columns
char keys[ROWS][COLS] = {
{'1','2','3','S', 'A'},
{'4','5','6','N', 'B'},
{'7','8','9','P', 'C'},
{'0','.','>','=', 'D'},
{'F','B','X','Y', 'Z'}
};
byte rowPins[ROWS] = {39,37,35,33,31}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {38,36,34,32,30}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
}
void loop() {
key = keypad.getKey();
if (key == 'Z')
{
mySerial.write(267);
}
else if (key == 'A')
{
mySerial.write(768);
}
}
//code for receiver (uno)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //rx, tx
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
}
void loop() {
while( mySerial.available()>0)
{
Serial.println(mySerial.read());
}
}