|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Breaker Switches and Buttons to Motors
How do I wire the true/false of a joystick button into an if square thingy? And how do I make it so in one case it doesn't connect the wired but in another it does?
Also how do i change a button (green) to a motor value (orange) ...??? Thanks. And don't see the title "breaker switches" and post something about the compressor, i can't understand that in the compressor... |
|
#2
|
|||
|
|||
|
Re: Breaker Switches and Buttons to Motors
A case structure enforces you to produce data for all cases. If it didn't, and someone tried to use the data, it would be an uninitialized variable. You can move the motor update block into the structure itself and only call it in one frame, or you can output the same value that you sent the last iteration.
For changing a Boolean into a number, the typical approach is to use a case structure or a select block to choose between two numbers. Greg McKaskle |
|
#3
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
Quote:
Also do you mean that just wiring my Boolean (in this case something that should be connected to breaker switches) up to the side of the diagram makes it determine what the if returns as? Quote:
Thanks. |
|
#4
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
How do I set up a single motor?
|
|
#5
|
|||||
|
|||||
|
Re: Breaker Switches and Buttons to Motors
(I'll answer the question I think you're asking. If what I'm saying doesn't make sense, try asking again using different workds.)
The functions for working with individual motors are two more levels deep in the function palette: WPI Robotics Library >> RobotDrive >> Advanced >> MotorControl. Look at the "Motor Control.lvproj" example to see how the Motor functions are used. |
|
#6
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
Quote:
|
|
#7
|
|||||
|
|||||
|
Re: Breaker Switches and Buttons to Motors
I didn't say anything like that. What did you see that made you think that's what I meant?
Do you understand what "WPI Robotics Library >> RobotDrive >> Advanced >> MotorControl" is referring to? Do you know how to find the FRC examples like "Motor Control.lvproj"? Your terminology is very vague and informal, and it's making it difficult for me to understand how best to help you. Perhaps you should take advantage of some of the tutorials at http://frcmastery.com/ so we can communicate more effectively. |
|
#8
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
Quote:
Sorry about that, will check that link and try being more specific. EDIT: Sorry, was mixing up drive and motorcontrol... Last edited by sthreet : 31-01-2013 at 16:15. |
|
#9
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
UPDATE: We have a bug:
I've narrowed it down to the following: A DIO get refnum is wired into the get for DIO In which is wired into a case structure, in the false part of the case structure a get refnum for the motor i am using is connected to a set output (which the input of the set out and the motor stuff should be working because it was working before i put it in a case structure. Another setup of what is show above is their except for a different DIO. I'm pretty sure the error is with the way i did the DIO... Buttons operate case structure fine and worked before i put motor in the case structure, breaker switches hooked up and tried with them on and off, didn't work... EDIT: I deleted the wires from the DIO in get and wired false things to that, one direction works find now but the other (each case statement is a direction) goes in spurts and at like half speed... Last edited by sthreet : 31-01-2013 at 19:11. |
|
#10
|
|||||
|
|||||
|
Re: Breaker Switches and Buttons to Motors
What do/did you have wired to the DIO pins?
The "one way works haltingly at half speed" symptom points to a common programming mistake. You're trying to run the motor one direction with the first case block, and the other direction with the second case block, right? The problem is probably that both blocks are turning off the motor in their False case. You have two places setting the motor speed, and one of them "wins". Imagine you're trying to run the motor forward. The "turn it off when not requesting backward" case turns it off, but the "turn it on when requesting forward" immediately turns it on and it works as you expect. But when you try to run the motor backward, the "turn it on when requesting backward" case turns it on, but the "turn it off when not requesting forward" immediately turns it off and it only gets a little twitch of motion. Do you want to use two joystick buttons to control a motor's forward/reverse motion? There are examples of how to do exactly that posted on the Chief Delphi forums; do a forum search for "button motor" and you'll find lots of helpful advice. |
|
#11
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
What i'm saying is that my joystick buttons worked fine using a case structure and constant numbers to control them, now that i split the motor up into two other case structures that have the input of the DIO (both in the false position) they still rely on pushing a button, but one works weirdly, and considering i kept the code the same with different names (to reference different things) I wonder why this is... One is one, other is negative one and if i press both buttons they cancel out and do nothing...
I'll see if i can look at DIO pins, not 100% certain what that is but i should be able to figure it out, either with google or my teacher/mentor/whatever you call him might know. EDIT: I suppose if I can't figure it out today i'll take some pictures of what the code is and put that up. Last edited by sthreet : 01-02-2013 at 10:41. |
|
#12
|
|||||
|
|||||
|
Re: Breaker Switches and Buttons to Motors
That would be very helpful. For example, you've been referring to DIO inputs, but I'm pretty sure that's not what you mean. Seeing what you're actually doing will be good.
|
|
#13
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
Sorry, was lazy over the weekend, will get it in when i get home today.
EDIT: Also where do I find the things for the logitech gamepad F310? Last edited by sthreet : 04-02-2013 at 19:08. |
|
#14
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
Here's some, i'll edit the others into my previous posts.
|
|
#15
|
||||
|
||||
|
Re: Breaker Switches and Buttons to Motors
Edit doesn't seem to be their for the one before you posted...
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|