Varible Conversion & Serial question

The packet (r) needs to be between start and end markers. Try sending "", instead of "r".

i forgot, and tryed it by sending:
but it didn't change anything still no movement..
any idea's?

This doesn't look good:

  if(vw_get_message((uint8_t*)recived, &buflen))

By the look of the foregoing, it should be

  if(vw_get_message(buf, &buflen))

and then you'll need to pass buf[1] (perhaps) to Move.

any idea's?

As a matter of fact, yes. Add some serial output. Are you receiving what you think you are?

The move() function on the receiver is passed an array of chars. It expects a char. Fail!

Some of the motor control wires control direction, and should be connected to non-PWM pins, with digitalWrite() used to control them. Do the motors do what they are supposed to with a simple sketch on the receiver?

What, exactly, is connecting the two Arduinos?

okey i figured i had my transmit module wired incorrect (5v to ground, and ground to 5v) could this 'kill' my module?
i changed code many many times already and checked all connected pins (wich are now correct!), lost of testing,
i added a LED on d13 wich flips state on reciving data, but sadly the power led never goes LOW. (this is the UNO on breadbord)

Problem: or im not transmitting, or im not reciving..

note's:
also i added a serial.print function wich prints the inData after it 'should' be transmitted by rf.
i changed pins from rf modules to defauls for VirtualWire (from 4 to 11 for RX, & 12, TX)

here's the codes:

Control Unit

#include <VirtualWire.h>
#define SOP '<'
#define EOP '>'

bool started = false;
bool ended = false;

char inData[80];
byte index;

void setup()
{
  //setup a serial connection
  Serial.begin(57600);
  
  //Setup VirtualWire to transmit on 4
  vw_setup(100);
  
  pinMode(13, OUTPUT);    //Power LED
  digitalWrite(13, HIGH); //Always ON
}

void loop()
{
  while(Serial.available() > 0)
  {
    char inChar = Serial.read();
    if(inChar == SOP)
    {
       index = 0;
       inData[index] = '\0';
       started = true;
       ended = false;
    }
    else if(inChar == EOP)
    {
       ended = true;
       break;
    }
    else
    {
      if(index < 79)
      {
        inData[index] = inChar;
        index++;
        inData[index] = '\0';
      }
    }
  }
  
  if(started && ended)
  {
    // The end of packet marker arrived. Process the packet
    vw_send((uint8_t *)inData, strlen(inData));
    Serial.println(inData);
    
    // Reset for the next packet
    started = false;
    ended = false;
    index = 0;
    inData[index] = '\0';
  }
  
  delay(40);
}

Device

#include <VirtualWire.h>

int m1r = 6;  //motor left red wire
int m1b = 5;  //motor left black wire
int m2r = 9;  //motor right red wire
int m2b = 10; //motor right black wire

void setup()
{
  //virtual wire setup 
  //for recive on pin 4
  vw_setup(100);
  vw_rx_start();
  
  pinMode(13, OUTPUT);    //power LED
  digitalWrite(13, HIGH); //Always ON
}

void loop()
{
  //variables setup
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  
  if(vw_get_message((uint8_t*)buf, &buflen))
  {
    move(char(buf[0]));
    digitalWrite(13, !digitalRead(13)); //flip POWER led
  }
}


//[FUNCTION] ~ move into recived driection (for,bac,lef,rig)
void move(char DIR)
{
  //Stop
  if(DIR == 'x')
  {
    analogWrite(m1r, 0);
    analogWrite(m1b, 0);
    analogWrite(m2r, 0);
    analogWrite(m2b, 0);
  }
  //drive forward
  if(DIR == 'f')
  {
    analogWrite(m1r, 255);
    analogWrite(m1b, 0);
    analogWrite(m2r, 255);
    analogWrite(m2b, 0);
  }
  //drive backwards
  if(DIR == 'b')
  {
    analogWrite(m1r, 0);
    analogWrite(m1b, 255);
    analogWrite(m2r, 0);
    analogWrite(m2b, 255);
  }
  //turn left
  if(DIR == 'l')
  {
    analogWrite(m1r, 0);
    analogWrite(m1b, 255);
    analogWrite(m2r, 255);
    analogWrite(m2b, 0);
  }
  //turn right
  if(DIR == 'r')
  {
    analogWrite(m1r, 255);
    analogWrite(m1b, 0);
    analogWrite(m2r, 0);
    analogWrite(m2b, 255);
  }
}

@PaulS:

As a matter of fact, yes. Add some serial output. Are you receiving what you think you are?

okey i dit so, i am outputting the inData from the arduino board. also i added for the device/robot a little code to flip power led (from high to low and from low to high [D13])

What, exactly, is connecting the two Arduinos?

the 'two' arduino's are connected by air..
i got these arduino's:
1x uno
1x uno on a breadboard (http://arduino.cc/en/Main/Standalone)

the broadboard uno has the reciver and is the device with motors, next to him lies the arduino uno with serial connection (usb) to the pc communicating with arduino IDE

Some of the motor control wires control direction, and should be connected to non-PWM pins, with digitalWrite() used to control them. Do the motors do what they are supposed to with a simple sketch on the receiver?

i have tested my motors before without RF communication to controll them with pwm, and it sucseed (PS: im using a half h-bridge)
(if i am not mistaking) if d9 outputs 5v it is outputting a digital 1 or HIGH, wether it is by pwm(255) or by digitalwrite(HIGH)..
( im sorry if i missunderstand, my english isn't the best..)

The move() function on the receiver is passed an array of chars. It expects a char. Fail!

i geus i changed that now.. (look at new code)

did my post sink in all other posts without notice, or does nobody have a clue what could be wrong here?

the 'two' arduino's are connected by air..

Well, there's your problem. The Arduino's a no good at transmitting data by air.

i added a LED on d13 wich flips state on reciving data, but sadly the power led never goes LOW. (this is the UNO on breadbord)

The power LED on what? Why would you want the power LED to turn off?

did my post sink in all other posts without notice, or does nobody have a clue what could be wrong here?

You are not answering questions correctly, or are giving incomplete answers. It is hard to help you when you do that.

You are not answering questions correctly, or are giving incomplete answers. It is hard to help you when you do that.

oh, okey ill try a little bit harder..

what i mean by connected with air, means that there are no wires wich connects them.
and about the power led.. it indicates that power is ON, but i want i to turn off when i recive data, this is the only way that i know that data is recived.
but since the powerled doesnt turn off, there is either no data recived or transmitted.

any other questions wich i answering incrorrect or incomplete?

thnx alot for all the efford,
nick

what i mean by connected with air, means that there are no wires wich connects them.

If there is nothing connecting them, how do you expect data to get from one to the other?

and about the power led.. it indicates that power is ON, but i want i to turn off when i recive data, this is the only way that i know that data is recived.
but since the powerled doesnt turn off, there is either no data recived or transmitted.

On my Arduino, the only way to turn the power LED off is to remove the power source. I suppose you could connect a relay, and disconnect the power to the Arduino, by toggling the relay when data is received, but that defeats the purpose of having received data, doesn't it?

Unless you are talking about some other LED, in which case it isn't the power LED.

i connected a led to D13 on the arduino uno on a breadboard. next my code puts D13 high in the Setup(){}
so im not talking about the arduino uno wich transmits, but im talking about the arduino uno standalone wich should recive.

i connected a led to D13 on the arduino uno on a breadboard. next my code puts D13 high in the Setup(){}
so im not talking about the arduino uno wich transmits, but im talking about the arduino uno standalone wich should recive.

So, you are not talking about the power LED, and you still having nothing that sends data and nothing that receives data. And, you still can't understand why you can't turn the power LED off when data is received.

Did I miss something?

dit i forgot to mension that i am using a tranmitterr module & and reciver module wich commonicate trough RF (radiofrequenty) at 434Mhz?
maybe you are overlooking page 1?

You never explicitly mentioned it on page 1, you implied it, but subsequent posts led us to believe you thought RF was native to the MCU.

Have you gotten the virtualwire example code working?

You never explicitly mentioned it on page 1, you implied it

Exactly. Specifically, you have not mentioned WHICH RF modules you are using. That is what I have been trying to get you to do. Post links the modules, and show how they are connected to the Arduinos, and then we will have something to work with.

yes i had got the vw's example code working in a testing project to test the modules on any defects. (now im trying to use them in an actual project)
i made some photo's just now to show you the project (maybe this post should be moved to project guidence now?)

(im sorry im not all too clear)

here's links to the latest project photo's

ImageShack - Best place for all of your image hosting and image sharing needs
ImageShack - Best place for all of your image hosting and image sharing needs
ImageShack - Best place for all of your image hosting and image sharing needs
ImageShack - Best place for all of your image hosting and image sharing needs
ImageShack - Best place for all of your image hosting and image sharing needs
ImageShack - Best place for all of your image hosting and image sharing needs

and i added the technical datasheets with this post,
if you need it i can make the schamatic of both or just one.

thnx nick

rf-transmitter-434mhz-technische-datasheet.pdf (292 KB)

RWS-371-6_433.92MHz_ASK_RF_Receiver_Module_Data_Sheet.pdf (259 KB)

Have you ever seen a radio without an antenna? I see three wires going to the transmitter. It is not clear what those three wires connect to on the Arduino.

if you need it i can make the schamatic of both or just one.

Yes, it is needed.

i have conected the antennas, they are 13cm long, but they arnt very clear to see on the picture because the coating is black just like the desk.. if u look above the breadbord on the first picture u can notice the striped silver wire.

i am drawing the schematic already, ill post them a.s.a.p.

So at one point, you had it working, but you mentioned earlier that you had the polarity flipped on the transmitter. So have you tried the example code again to make sure that the transmitter wasn't fried?

no i haven't tryied that, should i? or is there somebody who says that it cant be fried on 5v because of a diode or something within the transmitter?

anyway: here are the schematics:
(see attachments);

nick