Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Programming FAQ (http://www.chiefdelphi.com/forums/showthread.php?t=31817)

paulcd2000 10-02-2007 14:44

Re: Programming FAQ
 
Here's one that i've been seeing a lot recently:
Q. How do i add kevin's [insert extra hardware name(e.g. camera, encoder, etc.)] code?
A. Look at the readme in the files that come with it. they tell you exactly how to do it.

vivek16 02-04-2007 16:18

Re: Programming FAQ
 
do i need to learn unix before i learn C? my mom has been telling me to do this before i attempt to learn c although i have gone through some of the tutorials and it does not seem to get mentioned anywhere.

bear24rw 02-04-2007 16:47

Re: Programming FAQ
 
Quote:

Originally Posted by vivek16 (Post 609807)
do i need to learn unix before i learn C? my mom has been telling me to do this before i attempt to learn c although i have gone through some of the tutorials and it does not seem to get mentioned anywhere.

Not at all.. if you don't know any C I would suggest following some tutorials at www.cprogramming.com and looking through the default code. I started with TI-BASIC (calculator) in 8th grade and have moved into maybe different languages. Once you learn the basics its really easy going from one to another

Neil [Coconuts] 25-01-2008 17:45

Re: Programming FAQ
 
Where can I find the default code for MPLabs?
The Link: http://innovationfirst.com/FIRSTRobo...umentation.htm
seems to be broken (or at least it won't load for me).
Can I get the code anywhere else?

program1 25-01-2008 21:41

Re: Programming FAQ
 
im have a bit of a problem, i've loaded the 2007 default code and now the controller moves the moters in reverse. did something happen to the program?

lukevanoort 25-01-2008 21:47

Re: Programming FAQ
 
Your motors are probably wired in reverse. Without additional sensors, your robot has no way of knowing which way the motors are actually turning (and even if it did, it doesn't know what you want as forward and backward until you add that). Try doing something like this:
Code:

pwm02 = 254 - p2_y;
instead of the usual
Code:

pwm02 = p2_y;
and see if that fixes the issue. You could also swap the position of the + and - motor wires on the Victor output. WARNING: Don't swap + and - wires on the Victor's power input; if you do that, the Victor will be destroyed.

program1 26-01-2008 14:30

Re: Programming FAQ
 
ok, thanks. now i have another question. is there a manual or a guide that teaches you how to program the hybrid mode?

jacobhurwitz 26-01-2008 14:44

Re: Programming FAQ
 
Quote:

Originally Posted by program1 (Post 686189)
ok, thanks. now i have another question. is there a manual or a guide that teaches you how to program the hybrid mode?

http://www.chiefdelphi.com/media/papers/1590

It says autonomous mode, but hybrid is the same thing (just with IR inputs).

Guardrail 25-02-2008 15:17

How do I program to buttons?
 
I am new to C programming, and I was wondering if it is possible to program to buttons instead of joystick. I learned a lot in the short time I was programming and i hope to learn more.

SL8 25-02-2008 15:30

Re: How do I program to buttons?
 
Quote:

Originally Posted by Guardrail (Post 707028)
I am new to C programming, and I was wondering if it is possible to program to buttons instead of joystick. I learned a lot in the short time I was programming and i hope to learn more.

What environment are you using? Regardless, it would depend on what kind of input the button causes to tell you the actual code.

JamesBrown 25-02-2008 15:41

Re: How do I program to buttons?
 
Quote:

Originally Posted by Guardrail (Post 707028)
I am new to C programming, and I was wondering if it is possible to program to buttons instead of joystick. I learned a lot in the short time I was programming and i hope to learn more.

Hey, you can absolutely us buttons instead of joysticks. If you want help with the code you are going to have to be a little more specific about how you want it to work.

Guardrail 25-02-2008 15:51

Well the claw is sopposed to pick up pvc rings, the strategy we used is the claw goes in the middle of the ring and opens up to put pressure on the sides of the ring to pick it up. The problem is, I dont know how to make a code to use the buttons instead of joysticks to make that happen. ( it is a 2 pronged gripper that opens and closes using a servo module)

Mark McLeod 25-02-2008 15:54

Re: Programming FAQ
 
Is this for the VEX platform?
And do you want to use the buttons on the back of the VEX transmitter?

Guardrail 25-02-2008 16:07

Yes this is ofr the VEX platform and I would like to use the buttons of the back of the transmitter

Mark McLeod 25-02-2008 16:26

Re: Programming FAQ
 
If you are using EasyC what version are you using? V2, EasyC Pro?
The function calls are different between the versions.

If you are using MPLAB to program, the default VEX code has an example of using the buttons. The following is a variation on that. The two buttons on one side are seen in the code as PWM_in5 and the two buttons on the other side arrive as PWM_in6. This code starts the claw in the middle (joystick rest) and moves it to one extreme when the down button is pushed and the other way when the up button is pushed. It holds the last position after a button is pressed.
Code:

// Claw servo
#define BUTTON_REV_THRESH      100
#define BUTTON_FWD_THRESH      154
 
// Servo values for open and closed positions
#define CLAW_OPEN 200
#define CLAW_CLOSED 10
 
  if (PWM_in5 < BUTTON_REV_THRESH)
  {
      pwm05 = CLAW_CLOSED; //The down button moves the servo plugged into PWM 5 one way
  }
  else if (PWM_in5 > BUTTON_FWD_THRESH)
  {
      pwm05 = CLAW_OPEN;  //The up button moves the servo plugged into PWM 5 the other way
  }

The values 10 and 200 would be replaced with the proper position on your particular servo. You can use a printf and the existing joystick setup to find out what servo value on the claw is open and what value is closed. The servo positions range from 0 at one extreme to 254 at the other. To avoid overstressing your servo only use the value you figure out that you need to hold the game piece.


All times are GMT -5. The time now is 08:25.

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