Go to Post To my surprise, purple painted air tanks were illegal last year. AB - Andy Baker [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-01-2007, 18:33
Wompas Wompas is offline
Registered User
FRC #1182
 
Join Date: Jan 2007
Location: Missouri
Posts: 7
Wompas is an unknown quantity at this point
Basic Question

We're running EasyC pro for our FRC robot and trying to learn the program.

We were wondering, first, what exactly is "auxiliary analog". It's the 4th option for an axis when you are manipulating something like OI to PWM. Is there a map for the joystick they give us? What are all the buttons called?

Also, how would I assign a value 0...255 to a button on the actual joystick, for example, the trigger. Lets say I wanted the trigger to make the motor attached to PWM number 1 run at 200 when it's pressed. How is that done?

Thanks a lot,

1182
  #2   Spotlight this post!  
Unread 19-01-2007, 18:37
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Basic Question

Code:
if (trigger == CLOSED)
     pwmXX = 200;
else
     pwmXX = 127;
  #3   Spotlight this post!  
Unread 19-01-2007, 19:21
Wompas Wompas is offline
Registered User
FRC #1182
 
Join Date: Jan 2007
Location: Missouri
Posts: 7
Wompas is an unknown quantity at this point
Re: Basic Question

Thanks Tom. We understand the logic behind it but we don't actually know how to implement the trigger in easyC. If you could give us a dumbed down version that would be great.

if (trigger == CLOSED)
pwmXX = 200;
else
pwmXX = 127;

^^ What function block (those things at the left of the screen that you drag in), i.e. "OI to PWM" lets me do that. We know what you mean in logic but what type of variables should "trigger" be set to.

Our problem is our lack of experience with EasyC, not with the logic. We just don't know how to implement it into EasyC Pro.

Thanks a lot
  #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.
  #5   Spotlight this post!  
Unread 20-01-2007, 14:33
Wompas Wompas is offline
Registered User
FRC #1182
 
Join Date: Jan 2007
Location: Missouri
Posts: 7
Wompas is an unknown quantity at this point
Re: Basic Question

Thanks a lot to both of you. It worked.

Peace

Wompas
Closed Thread


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