Chief Delphi

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

Erics626 21-01-2006 14:32

easyC trouble
 
Is there anyway to execute multiple if statements, while statements, or user functions that I wrote at the same time?

sirbleedsalot 21-01-2006 14:36

Re: easyC trouble
 
Is there anyone out there that would be willing to visit with us on the phone, we are having trouble getting easyc started. If you are interested in this you could email me with your number. My email address is dayle.haaland@k12.sd.us.
Thanks for any help.

BrianBSL 21-01-2006 14:36

Re: easyC trouble
 
Quote:

Originally Posted by Erics626
Is there anyway to execute multiple if statements, while statements, or user functions that I wrote at the same time?

All simultaneously? The PIC has no support for multi-threading built in, and isn't really fast enough to implement an "operating system" that would implement this.

Erics626 21-01-2006 14:41

Re: easyC trouble
 
Perhaps I should be more specific. We are trying to write a program for count wheel rotations. We want the left wheel to travel a different number of rotations than the right wheel. I created two different user functions, one for counting the left wheel and one for counting the right wheel. We implemented these functions into autonomous, but the wheels do not start at the same time. Instead, the left wheel goes the distance we set, and as soon as the left wheel is done, the right wheel begins to rotate and start its count.

ahecht 21-01-2006 14:59

Re: easyC trouble
 
You will need to combine the counting code for both wheels into a single user funtion or loop.

Also, this thread should probably go in the EasyC for FRC sub-forum

BradAMiller 22-01-2006 03:16

Re: easyC trouble
 
Quote:

Originally Posted by Erics626
Perhaps I should be more specific. We are trying to write a program for count wheel rotations. We want the left wheel to travel a different number of rotations than the right wheel. I created two different user functions, one for counting the left wheel and one for counting the right wheel. We implemented these functions into autonomous, but the wheels do not start at the same time. Instead, the left wheel goes the distance we set, and as soon as the left wheel is done, the right wheel begins to rotate and start its count.

I'm not sure exactly what you are really trying to do - sounds like making a turn using the wheel encoders. But to do literally what you asked for, you need to start both wheels going. Then in a loop, read each wheel count, and using two IF statements, stop each wheel when its count is greater than or equal to the count your are looking for.
That way the wheels will both be running at the same time and they will each stop independently after the correct number of rotations.

BradAMiller 22-01-2006 03:21

Re: easyC trouble
 
Quote:

Originally Posted by sirbleedsalot
Is there anyone out there that would be willing to visit with us on the phone, we are having trouble getting easyc started. If you are interested in this you could email me with your number. My email address is dayle.haaland@k12.sd.us.
Thanks for any help.

Before talking on the phone, can you be more specific about what doesn't work? Do you mean you installed it, and it doesn't run when you start it from the start menu? Or that robot programs you write don't start? Or you're having trouble getting started using EasyC?

sirbleedsalot 22-01-2006 19:03

Re: easyC trouble
 
Quote:

Originally Posted by BradAMiller
Before talking on the phone, can you be more specific about what doesn't work? Do you mean you installed it, and it doesn't run when you start it from the start menu? Or that robot programs you write don't start? Or you're having trouble getting started using EasyC?

We are having trouble getting started, like is there a default code to work off of ?And then how do you change that code?

BradAMiller 22-01-2006 21:39

Re: easyC trouble
 
Quote:

Originally Posted by sirbleedsalot
We are having trouble getting started, like is there a default code to work off of ?And then how do you change that code?

Good question!
The default code is there, but it's built-in. You just write programs that operate the robot and don't need to look at anything else. You can literally write 10 line (block) programs that drive using the gyro or camera for control.

Check out the tutorials in EasyC to get an idea of where to start. If you are still having trouble - send me email and we can talk off-line.

sirbleedsalot 28-01-2006 13:28

Re: easyC trouble
 
ok i've got my robot to drive and turn, using easyc to write the code, however i have another motor that i want to be able to turn on by pressing the trigger button on the joystick how do i write code for that, and that will turn the motor counter clockwise then if i release the trigger i want the motor to stop then if i press the thumb button the motor will turn clockwise, can someone give me detailed instructions.

BradAMiller 02-02-2006 08:10

Re: easyC trouble
 
Quote:

Originally Posted by sirbleedsalot
ok i've got my robot to drive and turn, using easyc to write the code, however i have another motor that i want to be able to turn on by pressing the trigger button on the joystick how do i write code for that, and that will turn the motor counter clockwise then if i release the trigger i want the motor to stop then if i press the thumb button the motor will turn clockwise, can someone give me detailed instructions.

Inside the loop where you are driving the robot, you need to read the trigger inputs from the joystick and operate the motors.

To read the trigger inputs, use the "Digital OI Input" block. It returns a 1 or a 0 depending on the state of the trigger. You can check that value and then decide whether or not to drive the motor. To operate the motor, use the "PWM Control" block. It takes a PWM port number and a speed.


All times are GMT -5. The time now is 14:54.

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