getting error in arduino program

please help me to sort out this problem in attachment

rupinder: please help me to sort out this problem in attachment

it looks like you forgot the closing curly brace after your setup() function

you should post your code...

thanx for your answer i succesfully created the program as i am creating gesture based robot using arduino and L293d ic i need some help as you know motor rotates when there is opposite olarity on either end and through porgram i have given several instruction you can check below.. int lm=9;//pin 9 of arduino to pin 7 of ic int lmr=8;//pin 8 of arduino to pin 2 of ic

int rm=10;//pin 10 of arduino to pin 10 of ic

int rmr=7;//pin 7 of arduino to pin 15 of ic

//+ve of lm to pin 6,-ve to pin 3 //+ve of rm to pin 11,-ve to pin 14

void setup()

{ pinMode(lm,OUTPUT);

pinMode(lmr,OUTPUT);

pinMode(rm,OUTPUT);

pinMode(rmr,OUTPUT); }

void loop()

{ digitalWrite(lm,LOW); //both move forward

digitalWrite(lmr,HIGH);

digitalWrite(rm,LOW);

digitalWrite(rmr,HIGH); }

in this case my motor is moving backward in high low high low condition but when i do change to low high low high mototr does not rotate in forward direction ..??

Have you got the rest of the chip wired according to this diagram?

yes i have made connections like this only my robot is moving only in backward direction or left and right but my bot is not moving in forward direction that means when i provide low high to motors it doesnot rotate i hae tried several combinations...

I think the L293d is suitable only to 5khz, you alternate high and low way too fast probably as the write takes only 50 microsecond which is 4 times too fast compared to 5kHz

Try just adding a delay(1); between setting up high and low.That is just for testing.

As you can go to 5kHz you could use delayMicroseconds(200); to be very close to the rated 5kHzwith a bit of protection because the digitalWrite will slow things too you could be ok going to 150 or do instead of 200.

Does the motor work forward and not backward if you reverse the wires?

i have made this part of my projects thanx for your replies but now i am stuck with my transmitter part please visit the link below and check stepp 5 here i am interfacing adlx335 with arduino and getting values for different directions like stationary, frward etc . after that i put rf transmitter on the breadboard with suitable connection i the whole of this transmitter program i coded the led of arduino toremin off at stationary position and glow at all other positions but this is not happening my led on arduino remains off irrespective of the direction in which adlx335 and transmitter moves please help me i would be thankful

http://www.instructables.com/id/Gesture-controlled-robot-using-Arduino/?ALLSTEPS

//Connect the Receiver data pin to Arduino pin 11

#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message

int ledPin=13;//led on pin 13 is ON except when bot is stationary

int lm=9;//pin 9 of arduino to pin 7 of ic

int lmr=8;//pin 8 of arduino to pin 2 of ic

int rm=10;//pin 10 of arduino to pin 10 of ic

int rmr=7;//pin 7 of arduino to pin 15 of ic

//+ve of lm to pin 6,-ve to pin 3 //+ve of rm to pin 11,-ve to pin 14

void setup()
{
//Serial.begin(9600);//Initialise the serial connection debugging

pinMode(ledPin,OUTPUT);
pinMode(rm,OUTPUT);
pinMode(rmr,OUTPUT);
pinMode(lm,OUTPUT);
pinMode(lmr,OUTPUT);

vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;

//Serial.print("Got: ");//debugging

for (i = 0; i < buflen; i++)
{
// Serial.print(buf*,HEX);//You may also use integer values debugging*

  • //Serial.print(’ ');// debugging*
    _ if (buf*==0x73)//Stationary*_
    * {*
    * digitalWrite(rm,LOW); *
    * digitalWrite(rmr,LOW);*
    * digitalWrite(lm,LOW);*
    * digitalWrite(lmr,LOW);*

* digitalWrite(ledPin,LOW);*
* }*
* else*
* {*
_ if(buf*==0x66)//Forward*
* {
digitalWrite(rm,LOW);
digitalWrite(rmr,HIGH);
digitalWrite(lm,LOW);
digitalWrite(lmr,HIGH);*_

* digitalWrite(ledPin,HIGH);*
* }*

_ if (buf*==0x61)//Backward*
* {
digitalWrite(rm,HIGH);
digitalWrite(rmr,LOW);
digitalWrite(lm,HIGH);
digitalWrite(lmr,LOW);*_

* digitalWrite(ledPin,HIGH);*
* }*

_ if (buf*==0x72)//Left*
* {
digitalWrite(rm,LOW);
digitalWrite(rmr,HIGH);
digitalWrite(lm,HIGH);
digitalWrite(lmr,HIGH);
digitalWrite(ledPin,HIGH);
}*_

_ if (buf*==0x6C)//Right*
* {
digitalWrite(rm,LOW);
digitalWrite(rmr,LOW);
digitalWrite(lm,LOW);
digitalWrite(lmr,HIGH);
digitalWrite(ledPin,HIGH);
}
}
}
//Serial.print("\n");// debugging*

* }
//delay(1000);
}*_

Please start using code tags. Read Nick Gammon's post at the top of this Forum on the proper way to post source code here using code tags.

So on the sender side they do this

if ((xval>370 && xval<385) && (yval>360 && yval<380)) //stationary or stop(transmitter parallel to ground)
  {
    digitalWrite(ledPin,LOW);
    send("s");
  } 
  else 
  { 
    if ((xval>395 && xval<416) && (yval>360 && yval<380)) //forward(transmitter tilted forward)
    {
      digitalWrite(ledPin,HIGH);
      send("f");
      
    }
    if ((xval>345 && xval<365) && (yval>365 && yval<381)) //backward(transmitter tilted backward)
    {
      digitalWrite(ledPin,HIGH);
      send("a");
      
    }
    if ((xval>370 && xval<380) && (yval>335 && yval<355)) //left(transmitter tilted to left)
    {
      digitalWrite(ledPin,HIGH);
      send("l");
     }
     if ((xval>370 && xval<390) && (yval>385 && yval<395))//right(transmitter tilted to right)
    {
      digitalWrite(ledPin,HIGH);
      send("r");
      
    }
  }

The 0xYY are just characters corresponding to f,a,l,r for forward, backward, left, right in ASCII. They are sent over the virtual wire to your program

For example

       if(buf==0x66)//Forward

Means if I have received a ‘f’ letter because ‘f’ in ASCII is 0x66

but f in ascii is 70 i think actually i am making a gesture based robot my transmitter porgram is

//Connect the Transmitter data pin to Arduino pin 12
//If you don’t want to use pin 12 use vw_set_tx_pin(transmit_pin), with transmit_pin being desired pin ,in void setup
//Refer to the documentation in link for more details

#include <VirtualWire.h>

int xPin=0;
int yPin=1;

int ledPin=13;//led on pin 13 is ON except when transmitter is parallel to the ground

void setup()
{
vw_setup(2000);//Bits per second
pinMode(ledPin,OUTPUT);
//Serial.begin(9600);//Initialise the serial connection debugging
}

void loop()
{
int xval=analogRead(xPin);
int yval=analogRead(yPin);

//Serial.print(“xval=”);
//Serial.println(xval);

//Serial.print(“yval=”);
//Serial.println(yval);

//delay(1000); //used to display values after 1s delay

//Serial.print("\n");

if ((xval>339 && xval<345) && (yval>334 && yval<339)) //stationary or stop(transmitter parallel to ground)
{
digitalWrite(ledPin,LOW);
send(“s”);
}
else
{
if ((xval>307 && xval<320) && (yval>336 && yval<344)) //forward(transmitter tilted forward)
{
digitalWrite(ledPin,HIGH);
send(“f”);

}
if ((xval>365 && xval<372) && (yval>674 && yval<678)) //backward(transmitter tilted backward)
{
digitalWrite(ledPin,HIGH);
send(“a”);

}
if ((xval>343 && xval<349) && (yval>297 && yval<310)) //left(transmitter tilted to left)
{
digitalWrite(ledPin,HIGH);
send(“l”);
}
if ((xval>344 && xval<348) && (yval>368&& yval<381))//right(transmitter tilted to right)
{
digitalWrite(ledPin,HIGH);
send(“r”);

}
}
//delay(1000);

}

void send(char *message)//send function definition
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}

this is transmitter program and its working correctly i want this set of instruction for rf reciever to recive and move my bot in the direction according to gesture the problem is that transmitter is working but reciver is not recieving or may be my program is incorrect
plzz help me to make the reciever program corresponding to transmitter program above … i would be thankful…

What part of "please use code tags" did you not understand?

Small case f - not capital F - and 0x denotes hexadecimal representation not decimal

I maintain ‘f’ is ASCII is 0x66

Please use code tag - can’t do anything with what you post.

what are code tags???

rupinder: what are code tags???

It's already been suggested that you "Read Nick Gammon's post at the top of this Forum". This is it. Pay particular attention to item #7:- How to use this forum - please read. (You should have read this before ever posting.)

You can see what code enclosed in [code]code tags[/code] looks like in reply #10 by J-M-L above.

my project is gesture based robot for that i ineed rf trasmitter and reciever
my transmitter program with adlx335 sensor is

#include <VirtualWire.h>

int xPin=0;
int yPin=1;

int ledPin=13;//led on pin 13 is ON except when transmitter is parallel to the ground

void setup() 
{
vw_setup(2000);//Bits per second
pinMode(ledPin,OUTPUT);
//Serial.begin(9600);//Initialise the serial connection debugging
}

void loop() 
{
int xval=analogRead(xPin);
int yval=analogRead(yPin);

//Serial.print("xval=");
//Serial.println(xval);

//Serial.print("yval=");
//Serial.println(yval); 

//delay(1000); //used to display values after 1s delay

//Serial.print("\n");

if ((xval>339 && xval<345) && (yval>334 && yval<339)) //stationary or stop(transmitter parallel to ground)
{
digitalWrite(ledPin,LOW);
send("s");
} 
else 
{ 
if ((xval>307 && xval<320) && (yval>336 && yval<344)) //forward(transmitter tilted forward)
{
 digitalWrite(ledPin,HIGH);
 send("f");
 
}
if ((xval>365 && xval<372) && (yval>674 && yval<678)) //backward(transmitter tilted backward)
{
 digitalWrite(ledPin,HIGH);
 send("a");
 
}
if ((xval>343 && xval<349) && (yval>297 && yval<310)) //left(transmitter tilted to left)
{
 digitalWrite(ledPin,HIGH);
 send("l");
}
if ((xval>344 && xval<348) && (yval>368&& yval<381))//right(transmitter tilted to right)
{
 digitalWrite(ledPin,HIGH);
 send("r");
 
}
}
//delay(1000);

}


void send(char *message)//send function definition
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}

now i have make reciever program for the simultaneous transmitter program below

#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message

int ledPin=13;//led on pin 13 is ON except when bot is stationary

int lm=9;//pin 9 of arduino to pin 7 of ic

int lmr=8;//pin 8 of arduino to pin 2 of ic

int rm=10;//pin 10 of arduino to pin 10 of ic

int rmr=7;//pin 7 of arduino to pin 15 of ic

//+ve of lm to pin 6,-ve to pin 3 //+ve of rm to pin 11,-ve to pin 14

void setup()
{
//Serial.begin(9600);//Initialise the serial connection debugging

pinMode(ledPin,OUTPUT);
pinMode(rm,OUTPUT);
pinMode(rmr,OUTPUT);
pinMode(lm,OUTPUT);
pinMode(lmr,OUTPUT);

vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;

//Serial.print("Got: ");//debugging

for (i = 0; i < buflen; i++)
{
 // Serial.print(buf[i],HEX);//You may also use integer values debugging
  //Serial.print(' ');// debugging

      if (buf[i]==0x73)//Stationary
      {
        digitalWrite(rm,LOW);  
        digitalWrite(rmr,LOW);
        digitalWrite(lm,LOW);
        digitalWrite(lmr,LOW);
      
        digitalWrite(ledPin,LOW);
      }
      else
      {
        if(buf[i]==0x66)//Forward
        {
          digitalWrite(rm,LOW);  
          digitalWrite(rmr,HIGH);
          digitalWrite(lm,LOW);
          digitalWrite(lmr,HIGH);
          
          digitalWrite(ledPin,HIGH);
        }
      
        if (buf[i]==0x61)//Backward
        {
          digitalWrite(rm,HIGH);  
          digitalWrite(rmr,LOW);
          digitalWrite(lm,HIGH);
          digitalWrite(lmr,LOW);
          
          digitalWrite(ledPin,HIGH);
      }
      
        if (buf[i]==0x72)//Left 
        {
          digitalWrite(rm,LOW);  
          digitalWrite(rmr,HIGH);
          digitalWrite(lm,HIGH);
          digitalWrite(lmr,HIGH);
          digitalWrite(ledPin,HIGH);
        }
      
        if (buf[i]==0x6C)//Right 
        {
          digitalWrite(rm,LOW);  
          digitalWrite(rmr,LOW);
          digitalWrite(lm,LOW);
          digitalWrite(lmr,HIGH);
          digitalWrite(ledPin,HIGH);
        }
       }   
}
//Serial.print("\n");// debugging
    }
    //delay(1000);
}

the problem is that my bot is not moving at all at any gesture my transmitter is working plzz suggest something

You can edit posts by clicking on the "Quick edit" control.

why anyone is not answering?

rupinder: why anyone is not answering?

I guess they're waiting for you to do some debugging and report your results.