View Single Post
  #5   Spotlight this post!  
Unread 11-02-2005, 13:15
Mark Pierce Mark Pierce is offline
Registered User
FRC #0085 (B. O. B.)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Zeeland, MI
Posts: 239
Mark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant future
Re: Hall Effect Sensor Example Code

Yes it can be overwhelming. I just sent this message to another rookie team who asked for assistance:

Our team has not used the hall effect sensors but the programming should be very similar to the encoder code found in Kevin Watson's code library.

The encoder project and the navigation project (if you have a gyro) have the best examples of encoder (or just counting) programming.

In the file encoder.c the Handler routines need to be changed if you do not have two sensors on each side as described in this thread:

http://www.chiefdelphi.com/forums/sh...t=32349&page=1

Read this thread and at least the most recent of the other ones when you do a search for hall effect sensors in the CD forums. They have a lot of useful information.

You would need to change the if statement to only count up if all of your moves are forward, or sense the direction you told each side to move instead of the second input value.

In your main autonomous code (or for testing, your regular processing also) you can then call Get_Left_Encoder_Count() and Get_Right_Encoder_Count().

Average the values to get distance traveled, take the difference to get an approximation of turning. If you keep speeds low enough that you don't have wheel slippage you should end up fairly close to where you want to go.

We've made our own encoders last year using optical sensors and a slotted disk, this year we bought encoders from USdigital.com. In 2003 we just did moves by setting joystick input variables to a desired value for a desired amount of time (based on a counter in the autonomous code). It didn't work every time, but at least we were on our way to where we wanted to be instead of standing still. Sometimes it even worked great!

Good Luck!

Last edited by Mark Pierce : 11-02-2005 at 17:21.