Shop OBEX P1 Docs P2 Docs Learn Events
SumoBot and Ping Sensor — Parallax Forums

SumoBot and Ping Sensor

electronicsteachelectronicsteach Posts: 3
edited 2007-03-06 15:19 in Robotics
Does anyone have any sample code that uses qti line sensors and Ping Sensors to locate their opponent?cool.gif
·I have started writing the code but I am having trouble implementing the Ping sensors into it.confused.gif
Thanks, Rick.
·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-06 15:07
    Hello,

    Could you post what you have so far?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • electronicsteachelectronicsteach Posts: 3
    edited 2007-03-06 15:14
    This is what I have...
    I like the fact of using subroutines to run the program.· I am looking for a way to take a distance less than 24 inches to set a bit to a 1 then use the statement if X = 1 then gosub forward (just an example),· This would be added to the main routine area.·· I am having trouble with the lookup or lookdown to change a number that is greater than 24 to 0 and less than or equal to 24 to a 1.

    Rick
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-06 15:19
    By your I/O declarations it appears you have 4 PING))) sensors? Well, for this example we’ll focus on one…Using your own example if you return the distance in the variable cm and want to set you flag based on a value of 24 using your parameters you do not need a LOOKDOWN. Simply use the following…Take care.

    IF cm < 24 THEN
      flag = 1
    ELSE
      flag = 0
    ENDIF
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.