Problem with VRBot and Bridge mode

Hello

First, sorry for my english, i promise that i will learn the idiom jeje.

I have got the easyVR commander 3.2.5, VRBot ( not EasyVR ) and Arduino Diecimila (with arduino 1.0 software).

I am using this configuration:

The digital pins 2 and 4 are connected with a wire.

And the next program in arduino:


include

include "protocol.h"

uint8_t _receivePin;

uint8_t _transmitPin;

long _baudRate;

int _bitPeriod;

void setup(){

// PC UART Init

pinMode(0, INPUT); // sets the digital pin as input

pinMode(1, OUTPUT); // sets the digital pin as output

// VRbot UART Init

pinMode(12, INPUT); // sets the digital pin as input

pinMode(13, OUTPUT); // sets the digital pin as output

// Input Output Init

pinMode(2,INPUT); // sets the digital pin as input

pinMode(3,OUTPUT); // sets the digital pin as output

pinMode(4,OUTPUT); // sets the digital pin as output

digitalWrite(3,HIGH); // Set pin 3 high

digitalWrite(4,LOW); // Set pin 4 low

// connect Di2 to Di3 to enter Normal mode - Di2 is high

// connect Di2 to Di4 to enter Bridge mode - Di2 is low

// bridge mode allow direct communication between VRbot module and VRbot GUI software

if (digitalRead(2)==LOW){ // if Di2 is LOW enter Bridge mode

while(1)

{

int pc2vr = digitalRead(0);

digitalWrite(13, pc2vr);

int vr2pc = digitalRead(12);

digitalWrite(1, vr2pc);

}

}

bla bla bla.... the next is not important i think.


I uploaded this program in arduino, and open the easyVR commander. I press connect in easyVR commander and "Could not detect device connected to port COM17". In the arduino 1.0 i use COM17 for programming arduino.

I dont know what is the problems, i am desperate, some help?

Thanks!

I press connect in easyVR commander and “Could not detect device connected to port COM17”. In the arduino 1.0 i use COM17 for programming arduino.

Is the USB cable still connected to the Arduino? There is no Serial.begin() statement in the setup() function, so the inability of the software to connect to the Arduino makes sense.

  // PC UART Init

  pinMode(0, INPUT);         // sets the digital pin as input

  pinMode(1, OUTPUT);        // sets the digital pin as output

This is crap. Get rid of it. The hardware serial pins belong to the HardwareSerial instance, and should not be messed with.

A couple of general comments on coding style:

pinMode(0, INPUT);         // sets the digital pin as input

Comments that simply repeat what a statement does are at best unhelpful. Comments that say when a given bit of code is run ("we're entering bridge mode") or why you're doing something ("delay to allow XX to happen") are invaluable.

It's good practice to use a #define or constant definition to identify your pins rather than to embed the actual pin numbers throughout the code. Firstly because it's not obvious when you look at the code what pin you're dealing with, until you mentally look up the pin number; if you get it wrong anywhere, it won't be obvious. Secondly because when you define it in a central place it makes it safe and easy to change the pin number if you ever need to.

If you wanted, you could get away with using a single jumper that is present/absent to configure the mode, rather than using an extra pin and having two jumpers. To do this you'd enable the internal pull-up for the input, and then have the jumper pull it down by connecting to an output pin which was set LOW.