04-01-2017 10:57 AM
Hello!
My name is Dominic and I am on FRC Team 4779. We are looking for some help with programming an ultrasonic sensor into our code. The plan is to have an ultrasonic sensor measure the distance from the sensor to a wall. Once it is within the set distance (nine inches or less). I would like the code to activate a string of events to occur. We are lost being that we do not have a programming mentor anymore and are going off forum posts and other information we can find online.
04-05-2017 01:45 AM
04-07-2017 09:39 AM
Hello Dominic,
You might want to post or search chiefdelphi, as there will be a lot more FRC related content there. The above linked thread seems to be using DAQmx, which is not really an option for you on a roboRIO, I don't think. The sensor seems like it has a number of outputs (digital pulse-width, analog, serial) that you can choose from to read distance, mentioned under "Pin Out Description" on page 2. If no one on the team is familiar with any of the sensor output options, you might want to try exploring analog first, because it is very direct. You can even start testing with a volt meter if you want to make sure you are getting the right readings first. You can find distance by dividing your voltage by the ratio stated in the specification sheet.
Good luck and have fun!
04-10-2017 08:26 AM
Hey Dominic,
If you are using LabVIEW, there are MB1010 specific examples in the NI Example Finder. You can get to it from Help -> Find Examples..., once the example finder loads, go to FRC RObotics -> Sensors. You should see two MB1010 examples in the Sensors folder. On the front panel, there is a wiring diagram as well.
If you are not using LabVIEW, can you let us know what programming language your team uses? Also, what are you having trouble with? Are you having trouble with wiring? reading the values from the sensor? or programming the code that active a string of events?
04-10-2017 08:29 AM
Hey Dominic,
Just realized that you posted on the LabVIEW section of the forum. There is a FRC section, try posting it there in the future.