To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 224
    Blocking IR —Phil Mack
   Before I start trying to do this, does anyone know why the LegOS function write_ir is a blocking function? I'm trying to write an IR detection system but am unable to do so in LegOS because every time I write a byte to the IR port the RCX locks up. (...) (25 years ago, 10-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Kekoa Proudfoot
   (...) Do you mean dir_write? This is a problem with LegOS only. If you want non-blocking writes, comment out (in version 0.1.7 at least): while(dir_tx_state==TX_ACTIVE) ; // FIXME: scheduler integration if(dir_tx_state==TX_OK) return len; // (...) (25 years ago, 10-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Kekoa Proudfoot
   (...) I forgot to mention. At the top of dir_write, you probably want to add: if (dir_tx_state == TX_ACTIVE) return -1; Or something to that effect, so you don't transmit a second message while a first is still transmitting, and so you have a way of (...) (25 years ago, 10-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Phil Mack
     Great, I'll try this out tonight. Many Thanks, Phil. (...) (25 years ago, 14-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Phil Mack
   Here is some code for IR detection, with the help from Kekoa. However it doesn't work. I know the hardware is all working because if I run minicom and then run this programme and point the RCX at the lego tower junk appears on the screen. If I take (...) (25 years ago, 15-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Kekoa Proudfoot
   Regarding your program. Try sending 0s, not xs, i.e.: char *buffer = "\0\0\0\0\0"; Zeros are coded with the IR on 91% of the time, while xs are coded with the IR on only 45% of the time, neglecting the modulation, which cuts that all down by half. (...) (25 years ago, 16-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Phil Mack
   Thanks for your help but I think I might have a broken RCX. The code I've been testing and the examples you have help me with all work if I place the light sensor about 2 mm from the IR transmitter. At about 2cm it no longer works at all. I have (...) (25 years ago, 20-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Kekoa Proudfoot
   (...) I doubt you have a broken RCX. If you did, firmdl.c would not download firmware correctly. (...) That is a good thing to try; I suppose it did not help things? (...) I don't see why you couldn't post the .srec file. I don't know if you also (...) (25 years ago, 20-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Kekoa Proudfoot
   (...) So I just tried this, and it took more than a few minutes to get it to work. But it does work. Apparently, the modulation of the IR signal is needed for the light sensor to give a reading. The standard modulation used during regular IR (...) (25 years ago, 20-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Kekoa Proudfoot
   In addition to what I mentioned in the previous message, I also set the sensor input port to active. Setting it to passive also works, in which case the ambient light level seems to be around 480-495, and the sensor aimed directly at the IR port (...) (25 years ago, 21-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Phil Mack
    I'll have to wait now till I get home from work to try the examples :( Phil (...) (25 years ago, 21-Jun-99, to lugnet.robotics.rcx.legos)
   
        Re: Blocking IR —Phil Mack
   Hi Kekoa, Could you post your working IR .srec code or email me if possible? I have tried the examples with the LegOS read sensor routines and I still get the same results. i.e. it works at about 2mm from the unit but fails after more than 5mm. I (...) (25 years ago, 21-Jun-99, to lugnet.robotics.rcx.legos)
 

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR