Problen with module robox IRdirection

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.

Open Irdirection.cpp and replace

#include <WProgram.h>

with

#include "Arduino.h"

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.

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.

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 :frowning: 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.

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

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 Robox Irdirection-红外方向传感器模块-Arduino爱好者 - Powered by Discuz! 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.

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........

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!

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);
    }
    Irdirection.cpp (915 Bytes)
    Irdirection.h (333 Bytes)*_

Hey Guys

I'm fairly new to Arduino, just got this module and been having the same problems as above. Has anybody found a full solution?

Thanks

Thanks Sorin for posting the code. I know it has been a while but I wanted to thank you ... I tried your libraries a while back and even they seemed to have an issue. So, I gave up on this project altogether.

~ Prash.

I found that the example code did not work with an UNO but does work with a MEGA.

Hi all. I had the same problem. My robox irdirection not work on MEGA 2560.
Below solution :

"

#include <SoftwareSerial.h>
void setup()
{
Serial3.begin(9600); // output to PC or other device
Serial3.println("Running IR Fire detection...");
Serial2.begin(4800); // port connected to Robox IRDirection module
}
/*****************************************************************/
int fire(char num_diode)
{
int val,i;
char c[5];

Serial2.print(num_diode); // select diode on IrDiredtion module

while(1)
{
if(Serial2.read() == 10) //stop at begin of data
break;
}

for(i = 0; i < 5; i++)
{
while(1)
{
if(Serial2.available()) // wait to ready for transmit
break;
}

c = Serial2.read();

  • }*
  • val=0;*
  • for(i = 0; i < 5; i++)*
  • {*
    if((c >= 48) && (c < 58)) // ASCII table 48 - "0" ... 57 -"9"
    * {*
    _ val = val * 10 + c - 48;
    * }
    else*

    * return(val);
    }
    }
    /***********************************************************************/
    void loop()
    {
    int i,s;
    for(i = 0; i < 7; i++)
    {
    s=fire(i);
    Serial3.print(s);
    Serial3.print(" ");
    }
    Serial3.println();
    delay(1000);
    }
    "*_