Shop OBEX P1 Docs P2 Docs Learn Events
Reflective object sensor — Parallax Forums

Reflective object sensor

leshea2leshea2 Posts: 83
edited 2007-03-21 23:48 in BASIC Stamp
What does it mean when I use this command,
' {$STAMP BS2sx}
' {$PBASIC 2.5}
SI              PIN     6               ' serial input
FC              PIN     7               ' flow control pin
#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    T1200       CON     813
    T2400       CON     396
    T9600       CON     84
    T19K2       CON     32
    T38K4       CON     6
  #CASE BS2SX, BS2P
    T1200       CON     2063
    T2400       CON     1021
    T9600       CON     240
    T19K2       CON     110
    T38K4       CON     45
  #CASE BS2PX
    T1200       CON     3313
    T2400       CON     1646
    T9600       CON     396
    T19K2       CON     188
    T38K4       CON     84
#ENDSELECT
Inverted        CON     $4000
Open            CON     $8000
Baud            CON     T38K4 + Inverted
letter          VAR     Byte
i               VAR     Byte            ' FOR/NEXT counter
Main:
DO
    SERIN SI, Baud, [noparse][[/noparse]letter]         ' receive one byte
    DEBUG letter                        ' display on screen
    PAUSE 10                          ' wait one second
LOOP                                ' repeat forever
  END

and it results in the debug screen displaying [noparse]/noparse][font=WP MultinationalA Roman]l[/font over and over again ? My stamp is connected to a Reflective object sensor, and I'm using the serin command to receive whatever is reflected back to the object sensor. Are there any examples of how to use a sensor and have it give you a message for whether or not it detects an object ?

Thanks !

Comments

  • boeboyboeboy Posts: 301
    edited 2006-12-16 01:50
    Could you post the web site that you got this sensor on and some docs on this sensor and then I might be able to help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • FranklinFranklin Posts: 4,747
    edited 2007-03-21 19:02
    First of all that's not a command, it's a program. and second why are you trying to get serial data from a transistor? Get the document "what is a microcontroller" and read it then go on to the sensor document.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • PARPAR Posts: 285
    edited 2007-03-21 23:48
    leshea2 said...
    What does it mean when I use this command,
    ...
    

    letter          VAR     Byte
    i               VAR     Byte            ' FOR/NEXT counter
    

    Main:
    DO
        SERIN SI, Baud, [noparse][[/noparse]letter]         ' receive one byte
        DEBUG letter                        ' display on screen
        PAUSE 10                          ' wait one second
    LOOP                                ' repeat forever
      END
    


    and it results in the debug screen displaying [noparse]/noparse][font=WP MultinationalA Roman]l[/font over and over again ? My stamp is connected to a Reflective object sensor, and I'm using the serin command to receive whatever is reflected back to the object sensor. Are there any examples of how to use a sensor and have it give you a message for whether or not it detects an object ?
    Please provide a drawing of the circuit you have wired up. (What device(s) and parts·is/are connected, and where, to your Stamp?)
    Is the above program intended to be used with that circuit? (I.e., did someone give it to you and tell you that it "works" with the circuit? Or did you write the program expecting it would work with the circuit?)
    PAR
Sign In or Register to comment.