View Single Post
  #7   Spotlight this post!  
Unread 15-01-2012, 22:20
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: LabView and Ultrasonic Rangefinder

Quote:
Originally Posted by DominickC View Post
Now, what are the pro's and con's for using analog versus digital?
Both of the examples give you a continuously updating sensor value that you can read at any time. The digital connection is theoretically less susceptible to electrical noise within the robot. The analog connection might be preferable if you want to use the digital inputs for other sensors. It is also possible to do some more complicated wiring to the digital connections that lets you choose when to activate the sensor, which cuts down on interference if multiple sonar rangefinders are in use at the same time.

Quote:
Originally Posted by DominickC View Post
And if I wanted to import the example code into the example teleop.vi, could I just copy/paste the code in, and put it within a while loop which becomes true when a button on the joystick is pressed? (thus ranging once and displaying one distance in the dashboard)?
For a "ping on demand", you'll need to read up on the MB1010 documentation and find out how to control it with that level of detail. Displaying things on the dashboard is another topic entirely, and I should probably come up with a good instructional document -- once I figure out a better way to do it than the manual synchronization of clusters that I used last year.

In general, applying the examples to a robot project is a matter of putting everything to the left of the example's while loop into Begin, putting everything inside the while loop into Teleop (or Periodic Tasks), and everything after the loop into Finish. Use a RefNum Registry Set in Begin to save the reference for later retrieval with a RefNum Registry Get. For some of the examples, you might want to look up the documentation for the "Data Operations" item on front panel controls, specifically the "Make Current Value Default" command.

The analog example actually has some things inside the while loop that probably belong in Begin. The digital example is much more straightforward to put into a robot project.
Reply With Quote