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…

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

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 try that, same section as ifs?


How do I set up a single motor?

(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 so we can communicate more effectively.

No, i probably don’t; i’ll check it out later when i get to the computer; probably mixed it up with something else…

Sorry about that, will check that link and try being more specific.

EDIT: Sorry, was mixing up drive and motorcontrol…

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…

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.

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.

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.

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?

Here’s some, i’ll edit the others into my previous posts.

Edit doesn’t seem to be their for the one before you posted…

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.

Hmm… i’ll try a USB drive, we were having problems with internet on that computer for some reason i’m not sure of…

Hmm… now that i understand what you mean by DIO pins better i can check that; so pins are the little box thingies?

The open and close and get for the controller… The VI’s… (sorry for use of pronouns)

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.

Wired into the Digital I/O into signal and negative.

I’m not able to give useful advice based on half an answer. May I have enough information to understand your goals, please?

What device do you have connected to the DIO pins?

What do you want that device to do? What do you want the robot to do based on that device?

Pretend everything is working the way you want it to and describe in detail what I would see if I were watching it.