thanks for reply!
i have them work fine, as the rx receives data from the tx.
but, the question is, how can i make the tx RECEIVE from the rx? is that even possible to implement?
code for rx:
NOTE: the values of the received/transmitted bytes are determined by other functions in the code that the loop() calls them up, but they are irrelevant for this issue, so i didnt include them
byte TXdata = 0, RXdata = 0;
void setup()
{
Serial.begin(9600);
/*variables and pinModes*/
}
//************************************************************
//------------------------------------------------------------
void loop()
{
RX();
delay(100);
TX();
delay(100);
}
//************************************************************
//------------------------------------------------------------
void RX()
{
if(Serial.available()>=1)
{
RXdata = Serial.read();
Serial.flush();
return;
}
}
//************************************************************
//------------------------------------------------------------
void TX()
{
Serial.write(TXdata);
Serial.flush();
return;
}
code for tx:
byte tx = 0, rx = 0;
void setup()
{
Serial.begin(9600);
/*variables and pinModes*/
}
//************************************************************
//------------------------------------------------------------
void loop()
{
receive();
delay(100);
transmitt();
delay(100);
}
//************************************************************
//------------------------------------------------------------
void receive()
{
if(Serial.available()>=1)
{
rx= Serial.read();
Serial.flush();
return;
}
}
//************************************************************
//------------------------------------------------------------
void transmitt()
{
Serial.write(tx);
Serial.flush();
}code]