Shop OBEX P1 Docs P2 Docs Learn Events
QTI sensors — Parallax Forums

QTI sensors

JonathanJonathan Posts: 1,023
edited 2009-02-23 19:42 in Propeller 1
Hi All,

I'm playing with converting one of my Sumobots to a Prop, as part of a sumo class I am doing with some very bright students. My hope is to have them convert their bots over to a Prop as well, once we finish playing with them as BS2's.

Anyway, I'm having trouble with the QTI sensors. I dug through my personal archive and found lots of posts. I have tried using every variant of RCTIME (RC decay etc). I have tried replacing the 470 ohm resistor with a 330 (pulling the trace up on one sensor, grr) running them at 5V with a 1k resistor in series, everything I can think of. However, I get no variation of the readings, it always reads the same within a few counts. Here is the latest code:
CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    ' PropTerm
    #0, WHITE,CYAN,RED,PINK,BLUE,GREEN,YELLOW,GRAY 

    lLine       = 6
    rLine       = 7
           
VAR
long lLineSens, rLineSens

OBJ
term            : "PC_Interface
RC              :"Rc Decay.spin"   ': "RCTIME" 
PUB init
  term.start(31,30)
  term.out(0)
  wait_ms(1000) 
  term.str(string("Template.")) 
  wait_ms(1000)
  term.out(0)
  repeat
    lLineSens := rc.decay(0)
    rLineSens := rc.decay(1)
    term.str(string("Left: "))
    term.dec(lLineSens)
    term.str(string("   Right: "))
    term.dec(rLineSens)
    wait_ms(500)
    term.out(0)
 

Any Ideas?

TYVM,

Jonathan

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-23 17:22
    What's "Rc Decay.spin"? What's "PC_Interface"? Is this just a serial driver like Simple_Serial? Where does "wait_ms" come from?

    If your program worked, I wouldn't care, but it doesn't work and something in one of these items may be causing problems. There's no way to know.
  • JonathanJonathan Posts: 1,023
    edited 2009-02-23 17:43
    Mike,
    PC_Interface = the PropTerm debug window
    RC_decay = a spin program to read QTI sensors written by Beau
    wait_ms is a simple pause routine, works fine, here it is:
    pub wait_ms(ms) ' 
      waitcnt(cnt+(clkfreq / 1_000) * ms)
    return
    

    The usage I am using above is as the sample code, *if* I understand it correctly. I have also tried implementing it with the same charge/discharge cycle as in the standard sumobot code. Still no joy.

    Thanks!

    Jonathan


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • JonathanJonathan Posts: 1,023
    edited 2009-02-23 19:42
    In the "never mind" category.

    I had the white and red wires backwards. I had always *assumed* their functions and used them with the BS2 Sumo. A glance at the QTI schematic sorted that out. Hehe, well, live and learn. Sorry to all who lost some of their lives over this. [noparse]:)[/noparse]

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Sign In or Register to comment.