Thread: easyC trouble
View Single Post
  #7   Spotlight this post!  
Unread 02-02-2006, 08:10
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
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.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute