$$$ Rupee's for CODE $$$ ( Fun Wireless project )

Brief project statement:

Have two functional wireless sketches I'd like to integrate into a single functional sketch.

Brief project description:

The first sketch uses a 433mhz module paired with Uno-transmitter & Nano-receiver controlling a solenoid open/closed. (see attached sketch) The second sketch, HC-06 module is paired with android to control the on/off function of an led.

Essentially, the android app HC-06, should also control the open/close function of the solenoid while the functionality of the 433mhz remains unchanged.

The 433mhz uses a manual switch on uno to trigger the solenoid.
The HC-06 android app has two basic functions, [led on] [led off]

Proposed changes:

led on = solenoid open
led off = solenoid closed


if, uno's manual switch trigger's solenoid open, android can trigger solenoid closed, and vice versa.
if, uno's manual switch trigger's solenoid open, the manual switch can trigger solenoid closed.
if, android trigger's solenoid open, android can trigger solenoid closed.

HC-06 sketch detailshttp://www.instructables.com/id/Arduino-JY-MCU-Module-Bluetooth-Android-Applicatio/

/* Turn an LED on/off based on a command send via BlueTooth
** Credit: The following example was used as a reference
** Rui Santos: http://randomnerdtutorials.wordpress.com
int ledPin = 13;  // use the built in LED on pin 13 of the Uno
int state = 0;
int flag = 0;        // make sure that you return the state only once
void setup() {
    // sets the pins as outputs:
    pinMode(ledPin, OUTPUT);
    digitalWrite(ledPin, LOW);
    Serial.begin(9600); // Default connection rate for my BT module
void loop() {
    //if some data is sent, read it and save it in the state variable
    if(Serial.available() > 0){
      state = Serial.read();
    // if the state is 0 the led will turn off
    if (state == '0') {
        digitalWrite(ledPin, LOW);
        if(flag == 0){
          Serial.println("LED: off");
          flag = 1;
    // if the state is 1 the led will turn on
    else if (state == '1') {
        digitalWrite(ledPin, HIGH);
        if(flag == 0){
          Serial.println("LED: on");
          flag = 1;

Android app link: https://play.google.com/store/apps/details?id=com.anapp.bluecontrol

If interested PM me. I'll send over the 433mhz sketch.