I am not sure why he would just want it so you could bring it up and stop it. I will talk to the mentor and see if he will mind if i change it from joy stick to button. But He might just want it the way it is too xD he is hard to understand.. xD

Tue Dec 06, 2011 10:24 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Sevro button isssue

We are trying to get magnetservo to work and when we push a button nothing happens we notice none of the other buttons work on the 2nd contorl. here is the code

if(abs(joystick.joy1_y1) > threshold) // If the left analog stick's Y-axis readings are either above or below the threshold: { motor[motorD] = joystick.joy1_y1; // Motor D is assigned a power level equal to the left analog stick's Y-axis reading. } else // Else if the readings are within the threshold: { motor[motorD] = 0; // Motor D is stopped with a power level of 0. }

// -- Control Motor E

if(abs(joystick.joy1_y2) > threshold) // If the right analog stick's Y-axis readings are either above or below the threshold: { motor[motorE] = joystick.joy1_y2; // Motor E is assigned a power level equal to the right analog stick's Y-axis reading. } else // Else if the readings are within the threshold: { motor[motorE] = 0; // Motor E is stopped with a power level of 0. }

everything works just not the 2nd contorler buttons for the servos won't work.

Sat Dec 10, 2011 3:51 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: Trying to get Sonar Sensor to work on Autonomous

Did you enable dual joystick?

Sat Dec 10, 2011 5:29 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

We even tried that and still nothing happened with the servo's..

Sun Dec 11, 2011 1:27 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: Trying to get Sonar Sensor to work on Autonomous

If dual joystick was enabled, when you press the buttons on either joysticks, did you see the corresponding joystick buttons responding in the joystick dialog picture? If it doesn't, that's the problem. You need to figure out why the joystick dialog doesn't receive button events from that joystick. One thing to check is that if the two joysticks are associated correctly. In the dual joystick dialog, each joystick should have a drop-down menu let you pick the joystick association. Make sure each joystick is associated with a different physical joystick. If you associated both joysticks to the same physical joystick, pressing the buttons on the associated physical joystick will get responses from both joysticks in the dialog while pressing buttons on the other physical joystick will get nothing. If everything works correctly in the dual joystick dialog, then you should add the following lines in your code to display debug info to your NXT LCD screen:

If the LCD screen does show "Btn8 pressed" or "Btn8 released" when you press and release button 8 then you have a problem with your servo. Either there is a problem with the wiring of the servo or some components in the path have become bad such as the servo controller or the servo motors themselves. Also make sure the pragmas declaring the servo motors match the actual wiring. For example, according to your pragmas, the NXT sensor port 1 is connected to the first motor controller which daisy chained to a second motor controller which daisy chained to the servo controller which daisy chained to a third motor controller. Make sure the daisy chain seqence is correct. Also make sure the red power LEDs on all the controllers lit up when the main power switch is ON.

wait1Msec(3000); // wait 3 seconds to see feedback from the debugger screens // open the "NXT Devices" window to see the distance the encoder //spins. The robot will coast a little bit.}else if (joy2Btn(8) == 1){{

while (nMotorEncoder[gate1] < 0) //while the encoder wheel turns one revolution { motor[gate1] = -30; //turn both motors on at 30 percent power } motor[gate1] = 0; //turn both motors off wait1Msec(3000); // wait 3 seconds to see feedback from the debugger screens // open the "NXT Devices" window to see the distance the encoder //spins. The robot will coast a little bit.}

Sun Dec 11, 2011 2:58 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

What we are trying to do is open so much for a ball to go through it.so we want it to open then close when button is not prsssed we tried changing it to 7 and 8 as you can see but still it will not close.

Sun Dec 11, 2011 3:04 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: Trying to get Sonar Sensor to work on Autonomous

Sorry, I don't understand your replies and I also don't understand the last code you posted. Can you be more specific on what's not working? Also, I have suggested a lot of things to try in my last post. What are the results? I need to know the results so I can rule out the possibilities.

Sun Dec 11, 2011 3:10 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

That other code that you said had alot of problems were a code for a mentor.... not for the robot that i am useing. This code i am showing you now is the code i been staying with while i been showing you it xD haha but thye logo motor moves now but still not the servo will not move.... this is the code for the servo

If it doesn't, you have a joystick problem. If it does, you have a servo problem.

Sun Dec 11, 2011 3:36 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

And it never says it is pressed when i press it down

Sun Dec 11, 2011 3:51 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

I wi;look into it and see what is happening

Sun Dec 11, 2011 4:04 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

it's all goood all fixed i found the problem thx

Sun Dec 11, 2011 4:46 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: Trying to get Sonar Sensor to work on Autonomous

dtrain34555 wrote:

And it never says it is pressed when i press it down

So it's a joystick problem. I have suggested some steps to diagnose the problem in my previous post. Also make sure you did call getJoystickSettings somewhere in your robot main loop.

Sun Dec 11, 2011 4:52 pm

dtrain34555

Rookie

Joined: Tue Nov 01, 2011 9:18 pmPosts: 49Location: Davenport, Iowa

Re: Trying to get Sonar Sensor to work on Autonomous

The only thing that now has some issues that keep acting up is this part of the program. What i want it to do is have it when it sees a higher than the Magnet value... It will open gate2 then when not close it.

We also have been seeing it going on and on after the magnet goes so we want it to have a stop button point or something like that so it doesn't try to keep going. But also while it is looking for the magnet value to go up we want to make sure the button only works if the gate2 keeps running.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum