Is there anyway to execute multiple if statements, while statements, or user functions that I wrote at the same time?
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 [email protected].
Thanks for any help.
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.
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.
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
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.
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?
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.
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.