Go Down

Topic: Problen with module robox IRdirection (Read 2990 times) previous topic - next topic

Feder

Sep 11, 2012, 10:03 am Last Edit: Sep 11, 2012, 01:07 pm by Feder Reason: 1
Hi all.
I can not run the following module: http://www.cutedigi.com/robotics/irdirection-ir-breakout-with-uart.html
even with the simple example. I think it's a problem of the libraries. If anyone has ever used or known, please I would appreciate any help. Thank you.

dxw00d

Open Irdirection.cpp and replace
Code: [Select]
#include <WProgram.h>

with
Code: [Select]
#include "Arduino.h"

Feder

Thank you. I've done it, and have resolved all errors and I was able to load the program, but the module does not send any signal to arduino, I think there should be more errors in the library. I'll try to find them.

Hi Feder,

Did you figure out what the problem is and how to solve it? I too am having the same issue where there is no response back from ir.fireway() method. I am guessing it has to do with the line "if(i==97)" in Irdirection.cpp. I am guessing the code changed from 97 to something else.

Thanks.

Feder

Hi prashsaka,
I could not get a response from the module. I have not found the problem. Seek from the line of code that you show me, "if (i == 97)", to see if I find it.

Thanks.

I got in touch with the customer service at CuteDigi and they suggested that I try swapping Tx and Rx. I tried that but I still couldn't make it work.

Based on their internal testing, it seems to be working. I am not sure why it isn't for me. The only difference is that I am using Arduino Uno and they have something else.

Here is what they sent me.

Feder

I think the problem may be in the libraries incompatible with the Arduino IDE version because <WProgram.h> referred to the original program, it disappears from the 0023 version.

I tried with 0.23 version but even that didn't work for me :( I can get rid of the compile error but I still can't see the response from the sensor. Did it work for you?

Thanks.

Feder

No he recibido respuesta del modulo. Estoy igual que tu.

Feder

I have received no response from the module. I'm just like you.

Hi, I have some more information. But, I am not sure whether or not this will help.

Based on another site http://www.arduino.cn/thread-30-1-1.html I see that the library and the example code have changed. I can't download the new zip file as I am required to register and I don't know how to register.

If you want to, you can certainly try downloading the new zip and see whether it will work.

Good luck.

Feder

hello, I was unable to register, do not understand the Chinese captchas. I tried searching the new libraries elsewhere, but have not found anything. The search continues........

sorin_63

I have one of those sensors and it is working pretty well. Internally it uses COM1 (4800). With the demo file from examples, you must connect the sensor to COM1 (it is hardcodded into the driver)

I use Arduino 1280 with Arduino 1.0.1 IDE

The test program is:
//############test for Serial1 in arduino1280,arduino2560#########

#include "Irdirection.h"

void setup()
{
Serial.begin(9600);
}
void loop()
{
  irdirection x;
char a=Serial.read();
int w=x.fire(a);
Serial.println(w);
}

Hi Sorin,

Thanks for the tip. By the way, do you have the libraries? And if so, could you share it with us? If you don't mind, could you copy and paste the contents of Irdirection.h and Irdirection.cpp files as replies to this post? If you prefer, you can email the libraries to me at psaka4 at gmail dot com.

I think I am using older libraries and they do not have any "fire" method. Using the sample code you provided with the libraries I have, I get a compile error on line "int w=x.fire(a);". Instead, the method is "int irdirection::fireway(int rx, int tx, int temp)".

Thanks a lot!

sorin_63

here are the driver files
****************************************************************************************************************
File1: Irdirection.h
/*
  robox irdirection 
               auther:haishen
               date:2012.6.21
               test in atmega1280
               from:arduino.cn
*/
#ifndef IRDIRECTION_H_
#define IRDIRECTION_H_


class irdirection
{
public:
      irdirection();
      int fire(char temp);
  private:
     int sj;
};

#endif

********************************************************************************************************************
File2 : Irdirection.cpp
/*
  robox irdirection 
               auther:haishen
               test in atmega1280
               date:2012.6.21
               from:arduino.cn
*/
#include <arduino.h>
#include "irdirection.h"

irdirection::irdirection()
{
  Serial1.begin(4800);     //³õʼ»¯Ó²¼þ´®¿Ú1£¬Îª±£Ö¤Í¨ÐÅÎȶ¨£¬arduinoÓëÄ£¿éÖ®¼äµÄͨÐÅÉèÖÃΪ²¨ÌØÂÊ4800
}
int irdirection::fire(char temp)
{

  //unsigned int sj;
  unsigned char i;
  unsigned char hc[5];
  Serial1.print(temp); 
  while(1)
  {
    if(Serial1.read() == 0X0A)//¼ì²â½øÈë 
      break;
  }
  for(i = 0; i < 5; i++)
  {
    while(1)
    {
      if(Serial1.available())//½ÓÊÕ×Ö·û
        break;
    }
    hc = Serial1.read();
  }
  sj = 0;
  for(i = 0; i < 5; i++)
  {
    if((hc >= 48) && (hc < 58)) //ÅжÏÊÇ·ñ½áÊø
    {
      sj = sj * 10 + hc - 48;
    }
    else
      return(sj);
  }
// return(0xffff);
    } 

Go Up