Go to Post 3 weeks vacation here...every single day devoted to volunteering for FIRST. Am I crazy? Yes...I am most definately crazy...but crazy has never been this much fun. - Andy Grady [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
  #4   Spotlight this post!  
Unread 19-01-2007, 19:54
itsme itsme is offline
Registered User
FRC #2217 (FOMH)
Team Role: Programmer
 
Join Date: Dec 2006
Rookie Year: 2007
Location: Israel
Posts: 86
itsme is an unknown quantity at this point
Re: Basic Question

In order to set a value to 200 to a motor in port 1 when a button is pressed, You need to do the following: do a while loop that never ends:
Code:
 while(1)
Now, from the RC_Control functions drag and drop Digital OI Input function and in port enter the port of your joystick, in button return the button you want (let's say 1), and in retrieve into a local variable you made before that (let's call it buttonStatus (initialize it to be 0)). Now, do a while(1) loop. In the loop check: while(buttonStatus!=0) then do the following: drag the SetPWM from the output functions. Enter port 1, speed 200. Then, in the same inner loop, enter the Digital OI Input function in order to know if the button was released.
Now it should work
*could be that buttonStatus needs to be equal to 1 at the beginning and the while condition to !=1.

There is another, more better way to do it:
Do a while(1) loop, in it put the OI to PWM function from the RC_Control function blocks, and in the joystick port enter the joystick port, in the axis put the y axis (number 2) and in the PWM# put 1 (the PWM port). Now you can use your motor with the analog joystick (the motor has to be connected to a victor in order to set different speeds).
Hope I helped you

Last edited by itsme : 19-01-2007 at 20:08.
 


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
Basic Stamp Replacement Question Nate Smith Programming 4 13-07-2005 01:13
Probably a basic question, but.... Raven_Writer Programming 7 17-01-2004 01:04
Very Basic Programming Question kewlkid382 Chit-Chat 5 18-01-2003 11:11
Question about Basic Stamp miketwalker Programming 3 14-01-2002 13:10
Have a question about the Basic Stamp Chip Boards wes16zeus Programming 3 06-12-2001 08:25


All times are GMT -5. The time now is 23:52.

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