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.
Do you basically mean "put the whole thing, joystick things and all inside of the if statement?
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?
(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.
So you are saying that motorcontrol initializes and controls a single motor with its y input as the forward and x input as backward? Not to ask stupid questions but why does it have no pwm thingy? Also i hooked up a single motor that i initialized as two motors (made both pwms the same) and tried it, didn’t work… Do i have to change some pwms inside of it then?
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.
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…
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.
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.
I am unable to follow your code from the pictures. The wires are going in strange directions, are occasionally obscured by other things in the block diagram, and some go completely off the screen. There’s only a partial view of what’s in the Case blocks. You’ll have to attach the actual VIs before I can try to figure out what they’re doing. Even knowing what they’re doing isn’t going to help much if I don’t know what you want them to do instead. Can you give a simple explanation of what you’re trying to accomplish?
And I’ll repeat my earlier question: What do you have wired to the DIO pins? Specifically, what are the “Break1” and “Break2” inputs reading?
I don’t understand the question. Please try not to use the word “thing” without additional explanation.
No. Pins are metal pointy things that you physically attach wires to in order to bring signals and power to electrical components. The DIO pins are a long block of pointy metal bits sticking up near one edge of the Digital Sidecar. They come in sets of three, with +5 volts on the center pin, power return (-) on one of the side pins, and a signal (SIG) on the other side pin.
Your code is reading two of them. What is physically connected to those DIO pins on the Digital Sidecar? What are they supposed to make the robot do?
The open and close and get for the controller… The VI’s… (sorry for use of pronouns)
Gamepads are HID inputs. They are treated just like joysticks by the Driver Station. Use the same VIs that you’d use for a joystick.