Programming an encoder in LabVIEW?

My team and I are attempting to program an encoder to run a flywheel. Unfortunately we have aren’t having very much luck. I was wondering if anyone had an example or anything to help.:confused:

There are examples from the LV Getting Started window under Support->Find FRC Examples…->roboRIO->Sensors
An example for example is Encoder.lvproj
These are all stand-alone examples setup to use the Run Arrow over a USB connection to the roboRIO.

Here are other examples from our archive
Use an encoder as a Tachometer:

Generic Encoder:

So we have the begin programmed, but we are having trouble with the teleop part and how to connect the encoder vi to the motors

Here’s one way to control a flywheel:

Ok, my next question is where is that dbl icon, the one for RPM.
I’ve programmed everything else here.

That’s just a Create->Indicator shown with the icon option turned off.
What it looks like doesn’t really matter. It can be the big icon display you normally see.

It’ just there to show the RPM on the Front Panel in case you want to watch it changing.

So we got the encoder to control the speed of the wheel, but now we can’t figure out how to make it be controlled by a joystick button.

You have to describe what you want a joystick button to do.
Toggle the flywheel motor on and off?
Turn the flywheel on as the button is held?
Change the RPM target?

I want it to turn the flywheel on as the button is held

Wrap just the Motor Set Output in a Case statement, where the button feeds the case.
True, do what you have already.
False, set the motor to neutral.


OK so I tried what you said and put the motor set output pieces into a case structure and now it just wont do anything.::rtm::

You’d have to show your code if you want help figuring out what’s wrong.
Highlight the code and use the snippet option under Edit in the block diagram menu to create picture-code.

ok, ive got the snippet, how do I upload it to chiefdelphi?

You are probably restricted as a relatively new poster, but when you are able to post attachments you’ll see the “Manage Attachments” button below whenever you create or edit one of your posts.

I’ve sent you a PM with my email, so just send it directly as a mail attachment.

Email sent.

(I’m including your snippet here so others can follow along in case it’ll help someone else.)

The Joystick Get Values vi needs to be inside the loop.
That’s so the joystick value gets checked every loop.

What’s happening now is that the value of the button is only checked before the loop starts and at the moment it enters the wall of the infinite loop (false) is the only time the button value ever changes.
So it was false when it entered the loop and will remain false forever.