Go to Post I'm wondering just what you think the people who DID set this system up actually do for a living instead? Sheep farmers? - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 12-02-2014, 17:48
irvingc irvingc is offline
Registered User
FRC #0948 (Newport Robotics Group)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Bellevue, WA
Posts: 31
irvingc is on a distinguished road
Re: motor encoder java

Quote:
Originally Posted by Maxchrist View Post
we are trying to sense position. we have it on an a and b channel plugged into the digital i/0 on port 1 and 2.
This is not the proper wiring to use the encoder as an absolute sensor (position). Refer to the last section of Joe Ross's link.


[ edit ]
Provided you do want to use it as a quadrature, though, you would first create a new Encoder object:
Code:
Encoder encoder = new Encoder(aChannel, bChannel);
Then enable it:
Code:
encoder.start();
Then, you would read it like so:
Code:
encoder.getDistance();
Depending on the application, you may also want to calibrate the distance per pulse:
Code:
encoder.setDistancePerPulse(someConstant);

Last edited by irvingc : 12-02-2014 at 17:56.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:14.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi