Go to Post I will be here until the end of time working my butt off to inspire and enable the ever changing group of students that pass through our doors. - RoboChair [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 16-06-2008, 18:27
DanielR. DanielR. is offline
Registered User
no team
 
Join Date: Apr 2008
Location: SELU
Posts: 6
DanielR. is an unknown quantity at this point
WPILib and Ultrasonic sensors

Ok, I have an easy one.

I am trying to get ultrasonic sensors to work on a Vex using WPILib.

This is my code:
Code:
#define _VEX_BOARD
#include "API.h"
#include "BuiltIns.h"

#define UltraOnePing	1
#define UltraOneEcho	1

int sonicValue;

void main(void){

StartUltrasonic(UltraOneEcho, UltraOnePing);
PrintToScreen("Start");
	while(1==1)
           {
		sonicValue = GetUltrasonic(UltraOneEcho, UltraOnePing);
		PrintToScreen("Ultra returns %d. \n", sonicValue);
	
	   }
}
I get nothing. I have tried also with RobotC and had success, so I know the sensor works. I cannot figure out what is wrong.

Do I need to set port direction (tried that, didn't work, maybe I did it wrong)?

Does it have something to do with DefineControllerIO()?

Is it a conspiracy? I just don't know.

Last edited by DanielR. : 17-06-2008 at 12:59.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parallax and Maxbotix ultrasonic sensors Lucretius Programming 5 20-02-2008 14:34
Ultrasonic sensors on digital ports 3-6 problems wt200999 Programming 14 13-02-2008 08:13
Ultrasonic range sensors for Vex Robot OneCoolDude Programming 1 01-12-2007 09:22
can we use ultrasonic sensors? GMKlenklen Electrical 20 15-01-2007 14:34
Gryo, Camera, Accelorometer, Ultrasonic, and Gear Tooth Sensors in one program EHaskins Programming 8 22-05-2006 12:08


All times are GMT -5. The time now is 00:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi