Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp 2 with SensComp 6500 — Parallax Forums

Basic Stamp 2 with SensComp 6500

8888 Posts: 2
edited 2008-05-06 15:27 in BASIC Stamp
Hi, i'm currently on a project to connect SensComp 6500 ranging module ultrasonic sensors with Basic Stamp 2 which will be interface with LabView.. So far i have managed to obtain data from one ultrasonic sensor.. Below is the source code used:

' {$STAMP BS2}
dist VAR Word ' working variable for distance calculation
ECHO CON 15 ' sonar module echo detection output
INIT CON 14 ' sonar module control input ' 1 starts a measurement ' 0 resets the module
settle CON 1
delay CON 20
convfac CON 29
offset CON 700
loop:
GOSUB sr_sonar
DEBUG DEC dist,CR
PAUSE delay
GOTO loop
sr_sonar:
HIGH INIT
PAUSE settle ' be certain that ECHO is low
RCTIME ECHO,0,dist ' wait for ECHO to go high
LOW INIT ' reset module
dist=(dist+offset)/convfac
RETURN


I was wondering is there any way i can obtain data from 5 ultrasonic sensors instead of only 1??· DO u think i need to make changes in the above source code which will be load into the BS2 through Stamp Editor· or· by making changes to the LabView?· Please reply asap.. Thanks...

Comments

  • AmaralAmaral Posts: 176
    edited 2008-05-06 14:01
    Well , you can't read 5 ultrasonic at the same time , but you can read one at a time and as many as you want .

    BS are single task, always thing that you do one thing folowing the other.


    Hope to Help

    Amaral
  • FranklinFranklin Posts: 4,747
    edited 2008-05-06 15:27
    You can just add a subroutine for each sensor and like Amaral said read them one at a time. You will need to add more variables to hold the results of course.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.