View Single Post
  #4   Spotlight this post!  
Unread 23-01-2013, 20:03
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: ADXL345 SPI Accelerometer

Quote:
Originally Posted by Team3763 Adam View Post
How do I incorporate this into our team's current code which features drive, camera, joystick, etc.?
In general, everything left of the loop in an example goes in Begin, and everything right of the loop goes in Finish. The contents of the loop (except for the delay) goes in Teleop, or wherever you need to read the value. Do not copy the Start/Stop Communication functions.

The Open function produces a Device Reference. You'll need a way to make it available in other VIs; that's what the RefNum Registry Set and Get functions are for. Follow the pattern you see with Joystick and Motor refnums in the code. The SPI Set/Get functions are in the WPI Robotics Library -> Communications subpalette.

Things will probably work best if you copy the contents of the ADXL345 SPI Driver folder from the example project into your team's code, but I think you can get away with leaving them where they are as long as you don't make any changes to them.
Reply With Quote