After much mucking around, and finally getting the correct RX for the TX, I've made some progress. Taking PaulS's guidance (thanks BTW) I've modifed some existing code to reach my goals, and I'm close, so close, but it's not quite working exactly as it should. Here is my code.
/*
Modifed simple receiving code created by the awesome people at:
http://code.google.com/p/rc-switch/
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
pinMode(4, OUTPUT); // Location of Mosfet
pinMode(6, OUTPUT); // Operation Indicator LED
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value = 7419184) // This is the value received when button one on TX is pushed
{
Serial.print("Mosfet ON - Value = "); // This and the next two lines are for debug and testing purposes
Serial.print(mySwitch.getReceivedValue() );
Serial.print(" /// ");
digitalWrite(4, HIGH); // set the Mosfet On
digitalWrite(6, HIGH); // set the LED on
delay(5000); // wait for 5 seconds
digitalWrite(4, LOW); // set the Mosfet Off
digitalWrite(6, LOW); // set the LED Off
}
else if (value = 7419139) // This is the value received when button two on TX is pushed
{
Serial.print("Mosfet OFF - Value = "); // This and the next two lines are for debug and testing purposes
Serial.print(mySwitch.getReceivedValue() );
Serial.print(" /// ");
digitalWrite(4, LOW); // set the Mosfet Off
digitalWrite(6, LOW); // set the LED Off
}
else // If neither of the above two values are received it activates this message.
{
Serial.print("Received Other Value:"); // This and the next two lines are for debug and testing purposes
Serial.print(mySwitch.getReceivedValue() );
Serial.print(" /// ");
}
mySwitch.resetAvailable();
}
}
When Button one is pressed it does what it should, fires the mosfet and LED and prints "Mosfet ON - Value = 7419184 ///" to the serial monitor.
The odd thing, or perhaps a mistake in my code, when button two is pressed fires the mosfet & LED and prints "Mosfet ON - Value = 7419139 ///"
So basically it displays the correct Value for button two, but it prints and carrys out button ones actions/text.
Any help gratefully received. I've had so much fun working out finer points of the code (simple as it may be), but i'm now left not exactly sure what needs to be omitted/added.