Offline
Newbie
Karma: 0
Posts: 9
|
 |
« on: September 11, 2012, 03:03:22 am » |
Hi all. I can not run the following module: http://www.cutedigi.com/robotics/irdirection-ir-breakout-with-uart.htmleven 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.
|
|
|
|
« Last Edit: September 11, 2012, 06:07:19 am by Feder »
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #1 on: September 11, 2012, 04:14:16 am » |
Open Irdirection.cpp and replace #include <WProgram.h> with #include "Arduino.h"
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #2 on: September 11, 2012, 07:13:55 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #3 on: November 16, 2012, 05:46:10 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #4 on: November 17, 2012, 04:13:23 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #5 on: November 17, 2012, 08:37:24 am » |
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. 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #6 on: November 17, 2012, 11:10:25 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #7 on: November 17, 2012, 11:14:28 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #8 on: November 17, 2012, 12:38:05 pm » |
No he recibido respuesta del modulo. Estoy igual que tu.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #9 on: November 17, 2012, 12:38:37 pm » |
I have received no response from the module. I'm just like you.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #10 on: November 20, 2012, 03:48:43 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #11 on: November 23, 2012, 01:27:14 pm » |
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........
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 2
Posts: 6
Arduino rocks
|
 |
« Reply #12 on: November 30, 2012, 03:39:10 pm » |
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); }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #13 on: December 01, 2012, 12:38:31 pm » |
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!
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 2
Posts: 6
Arduino rocks
|
 |
« Reply #14 on: January 15, 2013, 03:41:53 pm » |
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); }
|
|
|
|
|
Logged
|
|
|
|
|
|