Error Help!? Please

My code is below and i am getting an error message
"exit status 1
expected primary-expression before ';' token" at for Serial.print("Received: "); for(int i = 0; i < byte; i++). Please help what do i need to add??

#include <VirtualWire.h>
int stageOne = 8;
int stageTwo = 9;
int motorPin[]={8,9};
void forward()
{
  digitalWrite(stageOne,HIGH);
  delay(100);
  digitalWrite(stageTwo,LOW);
}
void backward()
{
  digitalWrite(stageTwo,HIGH);
  delay(100);
  digitalWrite(stageOne,LOW);
}

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Device Ready");
vw_setup(2000);
vw_set_rx_pin(2);
vw_rx_start();
for(int i = 0; i< 12 ; i++)
{
  pinMode(motorPin[i],OUTPUT);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
byte buf [VW_MAX_MESSAGE_LEN];
byte buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf,&buflen))
{
  int i; 
  digitalWrite( 4,true); //led blinks

  for (i=0; i< buflen; i++)
  {
    Serial.print(buf[i]);
    if (buf[i]=='1')
    { forward();
    Serial.println("=forward");
    }
    if(buf[i]=='0')
    {backward();
    Serial.println("=backward");}
}
{Serial.print("Received: ");
[b] for (int i = 0; i < byte; i++)[/b]

{Serial.write(message[i]);}
}
Serial.println();
}
}}

Use CTRL-T in the IDE, or Tools:Autoformat, to clean up the { }, and you'll find some mismatches to clean up.
Perhaps like this:

#include <VirtualWire.h>
int stageOne = 8;
int stageTwo = 9;
int motorPin[]={
  8,9};
void forward()
{
  digitalWrite(stageOne,HIGH);
  delay(100);
  digitalWrite(stageTwo,LOW);
}
void backward()
{
  digitalWrite(stageTwo,HIGH);
  delay(100);
  digitalWrite(stageOne,LOW);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Device Ready");
  vw_setup(2000);
  vw_set_rx_pin(2);
  vw_rx_start();
  for(int i = 0; i< 12 ; i++)
  {
    pinMode(motorPin[i],OUTPUT);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  byte buf [VW_MAX_MESSAGE_LEN];
  byte buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf,&buflen))
  {
    int i; 
    digitalWrite( 4,true); //led blinks

    for (i=0; i< buflen; i++)
    {
      Serial.print(buf[i]);
      if (buf[i]=='1')
      { 
        forward();
        Serial.println("=forward");
      }
      if(buf[i]=='0')
      {
        backward();
        Serial.println("=backward");
      }
    }
    Serial.print("Received: ");

    for (int i = 0; i < byte; i++){

      Serial.write(message[i]);
    }
    Serial.println();

  }
}

Next, you need to do something about the message[] array. The complaint is more about that. You can expand the bottom error section to see more of that.

sketch_may19a.ino: In function 'void loop()':
sketch_may19a:53: error: expected primary-expression before ';' token
sketch_may19a:55: error: 'message' was not declared in this scope

What are those leading/trailing "b"s? looks like an artifact picked up from a copy somewhere. if that's proper arduino C syntax, thats over my head - nvr seen that.

for (int i = 0; i < byte; i++)

I also see you declare int i twice - in setup and loop, but since not a global, dont think that matters, just a touch confusing.

EDIT - ah - now I see from my post - those are HTML bold tags :slight_smile: [b..] and [\b..]

byte is a type. It can't be used a variable name. Your for loop makes no sense.

Thank You so much everybody!! I fixed my code a bit and tried to fix it, but its still saying there's an error with "pinMode(motorPin_,OUTPUT);" should i just take out the part?_
```
*#include <VirtualWire.h>
int motorOne = 8;
int motorTwo = 9;
int motorPin[] = {8, 9};
void forward()
{
  digitalWrite(motorOne, HIGH);
  delay(100);
  digitalWrite(motorTwo, LOW);
}
void backward()
{
  digitalWrite(motorTwo, HIGH);
  delay(100);
  digitalWrite(motorOne, LOW);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Device Ready");
  vw_setup(2000);
  vw_set_rx_pin(2);
  vw_rx_start();
  for (int i = 0; i < 12 ; i++)
  {
    pinMode(motorPin[i], OUTPUT);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  byte buf [VW_MAX_MESSAGE_LEN];
  byte buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen))
  {
    digitalWrite( 4, true); //led blinks
  int i;
    for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);
      if (buf[i] == '1')
      { forward();
        Serial.println("=forward");
      }
      if (buf[i] == '0')
      { backward();
        Serial.println("=backward");
      }
    }
    { Serial.print("Received: ");
      for (int i = 0; i < buflen ; i++)

{
        Serial.write(buf[i]);
      }
    }
    Serial.println();
  }
}
_
```*_

you should check the size of your motorPin Array :wink:
( and use the proper size for the for loop )

its still saying there's an error with "pinMode(motorPin,OUTPUT);"

What is "it" saying?

This BAD code compiles well , BTW:

int motorPin[] = {8,9};
void setup() {
  for (int i = 0; i < 12; i++)
   pinMode (motorPin[i],OUTPUT);
}

void loop() {
}