Go Down

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

Matfro92

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

prashsaka

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.

Matfro92

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

Smutator

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);
}
"

Go Up