I am using easyc 2.0 iwant to stop a motor using a limit switch. but for some reason the switch does not stop the motor. i used the if block and made the motor run cw if the switch was ==1 then i said else the limit switch ==0 then i put the motor block in the else as stopped
it should be
while ( 1 )
{
limit = GetDigitalInput ( 1 ) ;
if ( limit == 0 )
{
SetMotor ( 1 , 127 ) ;
}
else
{
SetMotor ( 1 , 255 ) ;
}
}
Thanks that worked! I am beginning to get the hang of this. I am progamming a robot with an arm that can raise up and reach forward. once activated by hitting a bumper a motor will lift the arm to a set hieght using shaft encoder, then i want the arm to reach forward using a motor until a limit switch in the hand touches the object (whatever i am picking up) once the limit switch is tripped the arm reach motor should stop and the hand (or gripper motor) should contract on the object, once this happens the arm reach motor should retract, and the motor that raised the arm should lower it to the original position. i dont know enough to get this to work. i have included the program i have so far, there are some bumper sensors in the code that i would like to use in RC mode to stop motors from going too far as well. any help would be greatly appreeciated!
cardel002.zip (196 Bytes)
Try watching this and see if it helps.
http://www.intelitekdownloads.com/easyCV2/VexProgramming.wmv
I have watched the video, please just give me a couple of lines of code and i will go from there. i have enclosed my robot map
StartEncoder ( 1 ) ;
while ( 1 )
{
Encoder = GetEncoder ( 1 ) ;
if ( Encoder > 300 ) // Encoder is greater than 300
{
SetMotor ( 1 , 127 ) ; // Stop Motor
}
else
{
SetMotor ( 1 , 255 ) ; // Run Motor
}
}
Oh and scissor lifts break hearts
This robot works with the default program! the lift goes up three feet! I know what you mean though, i have had a lot of trouble with the scissor lift. I am currently placing the sensors on the bot. When i finish i will take some pics.