View Single Post
  #2   Spotlight this post!  
Unread 02-01-2006, 11:20
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 3,078
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: Ultrasonic Sensor

Quote:
Originally Posted by winners
Dear sir/madam,

Where can I find, please, some open sample codes for programming the vex ultrasonic sensor as for easyC?

I'd appreciate any help given.

Thanks in advance!
Welcome to Chief Delphi Forums!

The test code for all of the Vex sensors (including the ultrasonic sensor) for EasyC is located by default in the following directory when EasyC is installed.

C:\Program Files\Intelitek\easyC\Projects\Test Code

Inside this folder should be a file named ULTRASONICTEST.ECP. This file contains the sample code used to run the Ultrasonic sensor. Here is basically what is contained in that file:
Code:
#include "UserAPI.h"

int ultrasonic; 

void main ( void )
{
      //Connect Input Wire to Digital Output 11
      //Connect Output wire to Interrupt 1
      //Near = 2, Far = 100
      StartUltrasonic ( 1 , 11 ) ; // interrupt 1= output label on sensor, DO11=input label on sensor
      while ( 1 )
      {
            ultrasonic = GetUltrasonic ( 1 , 11 ) ;
            PrintToScreen ( "ultrasonic =%d\n" , (int)ultrasonic ) ;
      }
}
__________________
Art Dutra IV
Robotics Engineer, VEX Robotics, Inc., a subsidiary of Innovation First International (IFI)
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon (Alumni) | @arthurdutra

世上无难事,只怕有心人.