this is the transmitter code.
Many thanks
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //RX, TX
int buttonPin = 8;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
int buttonState = HIGH;
mySerial.begin(9600);
}
void loop() {
int buttonState = digitalRead(buttonPin);//read button state
if(buttonState == LOW){ //if button is down
mySerial.println(1111);//send unique code to the receiver to turn on. In this case 1111
delay(50);
mySerial.flush();//clear the serial buffer for unwanted inputs
delay(50);//delay little for better serial communication
//mySerial.end();
}}
[code]