Shop OBEX P1 Docs P2 Docs Learn Events
Please help me with BS2 code for school robot project. Pic and code included!!!! — Parallax Forums

Please help me with BS2 code for school robot project. Pic and code included!!!!

Tony_tsiTony_tsi Posts: 98
edited 2012-05-20 14:03 in BASIC Stamp
I am building a robot for school. I do not use basic stamp very often and I need help with a select...case statement. The select statement needs to select inputs 9-15. The code is very simple. I need a line to replace ( SELECT IN9-IN15 )

robot.jpg


The code for the robot is in the link below.
code for robot.bs2
960 x 720 - 73K

Comments

  • Tony_tsiTony_tsi Posts: 98
    edited 2012-04-17 13:07
    I should add that the line ( SELECT IN9-IN15 ) looks good but doesn't work.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-17 13:12
    Your select condition, SELECT IN9-IN15, subtracts one bit input from another. Instead, try,
    SELECT INS >> 9
    
    This takes all 16 input bits as a word, and shifts it right by 9 positions, leaving bits 15..9 in positions 6..0.

    But even then, I'm not sure that's what you want. Pins 15..9 represent seven pins, but your conditions use only six.

    -Phil
  • skylightskylight Posts: 1,915
    edited 2012-04-18 07:56
    It may or may not be relevant to which type of sensor being used whether infrared or QTI but if you look at the example code on the product page for the QTI sensors it suggests the result of the sensor is saved to a variable first and then used wih the Select Case method rather than reading direct, the infrared sensor is read direct using INL perhaps its a timing thing?
  • Tony_tsiTony_tsi Posts: 98
    edited 2012-04-18 08:28
  • skylightskylight Posts: 1,915
    edited 2012-04-18 09:03
    Did you look at the example code on that product page? It suggests you use Select INL presuming you wired it as suggested to your robot.
  • Tony_tsiTony_tsi Posts: 98
    edited 2012-04-18 09:32
    The one parallax makes has 8 sensors I only have 5 on mine. Also INL selects inputs 0-7 I am using inputs 11-15. I think the suggestion from Phil will work i can test it today.
  • Tony_tsiTony_tsi Posts: 98
    edited 2012-05-20 14:03
    This worked great we won 1st place thanks for the help. info here: http://www.tonytronix.com/myprojects/ee101bugproject.html
Sign In or Register to comment.