Help :)

#include <VirtualWire.h>

int D0 = 7; //
int D1 = 6; //
int D2 = 5; //
int D3 = 4; //
int D4 = 3;
int analog_pin = A0;

byte message[VW_MAX_MESSAGE_LEN];
byte messageLength = VW_MAX_MESSAGE_LEN;

void setup()
{
Serial.begin(9600);
Serial.println("Device is ready");

vw_setup(2000);
vw_rx_start();

pinMode(D0, OUTPUT);
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(D3, OUTPUT);
pinMode(D4, OUTPUT);
pinMode(9, OUTPUT); //PWM MOTOR
pinMode(analog_pin, INPUT); //For INPUT
pinMode(13,OUTPUT);
}

void LED(){
int sensorValue =analogRead(analog_pin);
if(sensorValue >=100)
{
analogWrite(9,255);
delay(4000);

}

}

void loop() {

LED();

if (vw_get_message(message, &messageLength)) // Non-blocking
{
Serial.print("Received: ");
for (int i = 0; i < messageLength; i++)
{
Serial.write(message*);*
_ if(message*=='1')_
_
{*_

* digitalWrite(D0, HIGH);*
* delay(6000);*
* digitalWrite(D0, LOW);*

* digitalWrite(D1, LOW);*
* digitalWrite(D2, LOW);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, LOW);*

* }*

_ if(message*=='2')
{*_

* digitalWrite(D0, LOW);*
* digitalWrite(D1, HIGH);*
* delay(1000);*
* digitalWrite(D1, LOW);*
* digitalWrite(D2, LOW);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, LOW);*

* } *
_ if(message*=='3')
{*_

* digitalWrite(D0, LOW);*
* digitalWrite(D1, LOW);*
* digitalWrite(D2, HIGH);*
* delay(1000);*
* digitalWrite(D2, LOW);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, LOW);*

* }*

_ if(message*=='4')
{*_

* digitalWrite(D0, LOW);*
* digitalWrite(D1, LOW);*
* digitalWrite(D2, LOW);*
* digitalWrite(D3, HIGH);*
* delay(1000);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, LOW);*

* }*

_ if(message*=='5')
{*_

* digitalWrite(D0, LOW);*
* digitalWrite(D1, LOW);*
* digitalWrite(D2, LOW);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, HIGH);*
* delay(1000);*
* digitalWrite(D4, LOW);*

* }*
_ if(message*=='6')
{*_

* digitalWrite(D0, LOW);*
* digitalWrite(D1, HIGH);*
* digitalWrite(D2, HIGH);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, LOW);*

* }*
_ if(message*=='7')
{*_

* digitalWrite(D0, HIGH);*
* digitalWrite(D1, HIGH);*
* digitalWrite(D2, HIGH);*
* digitalWrite(D3, LOW);*
* digitalWrite(D4, LOW);*

* }*

* }*
* }*
* }*

Please put your code in its own window as seen in other posts. This can be done by placing     [code]  and [/code]  around the code or use the </> icon. This makes it easier for others to read. This can be done in your original post.

Pleas also tell us what your question is.

And edit your title to give a meaningful title!

Weedpharma

Hello

Thank you much for your helping

when A0 sends order the motor produce pulses for 1 min.
when I push number 1 button on remote control the LED turns on.
I want to these works at the same time(Simultaneous)
not like that code which first motor makes pulses for 1 min than LED turns on

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you tell us what you project is and what your problems with it are?

Thanks... Tom... :slight_smile:

Please do as requested in my earlier post.

Then read

http://forum.arduino.cc/index.php?topic=223286.0

Weedpharma

Please help us to help you. The forum software has eaten part of your code and turned the rest into italics. Code tags will fix this.

Also try to use more descriptive variable names. We know A0 is an analog pin. What is it connected to and why?