i am making gesure based robot for that i have made transmitter and reciever section my transmitter is working properly but my bot is not moving which is configured with rf 433 mhz reciver accordingly. my hardware is fine i think i my code is errorneous (but there are no errors in arduino ide)
here is my code
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);
}[code]
[/code]
and one more thing i am using adlx335 acclerometer for gestures with transmitter and arduino do i need to use encoder at transmitter and decoder at reciever section??