Shop OBEX P1 Docs P2 Docs Learn Events
Has anyone made a library for the Ping))) sonar? — Parallax Forums

Has anyone made a library for the Ping))) sonar?

cassiecassie Posts: 7
edited 2006-10-06 15:29 in General Discussion
I am a complete n00b at Java, so work with me here. I am just trying to debug and pull some values as measurements; I have copied the sample code from the sonar sample code but it is missing the library for it so it wont run. I have no idea how to make a library, and my project is on a tie constraint. If anyone has used this sonar and done a project with it that would be of great help to get some insight.

Thanx so much, any help would be greatly appreciated.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-10-05 16:38
    I found these classes on my pc.
    The classes are by Jon Williams so I expect them to work,
    but I can't tell for sure since I have no Ping module.

    regards peter
  • bulkheadbulkhead Posts: 405
    edited 2006-10-06 04:23
    I think I have used that same class before and it worked for me.

    Making a library is easy, its just about putting the file in the correct folder. The first line of the program says:
    package stamp.peripheral.sensor.range.ping;
    


    meaning that this "package" or file should be located in stamp>peripheral>sensor>range and be called ping.java (I am not sure if it needs to be Ping.java or ping.java to work, test it out). The stamp folder should be under the "lib" folder in your main Javelin Stamp IDE folder, which should be under program files>>Parallax Inc if you used the default settings.

    In order to use this program you must include the statement:
    import stamp.peripheral.sensor.range.ping;
    


    in your main program at the top so that the class will be "imported" into your main program so that you may use it.

    If you want to import all the files in a specific folder, just put a ".*" at the end, for example:
    import stamp.peripheral.sensor.range.*;
    


    will import all java files in the "range" folder.
  • cassiecassie Posts: 7
    edited 2006-10-06 15:29
    IT WORKED! Thank you so much both of you for helping me; I had no idea that the ping.java file just had to be moved, I thought I had to write a whole new one! It worked great now, I am explain how thankful I am for your help. I will post a movie of the final robot on its own smile.gif.

    Thank you all so much for your time, MUCH APPRECIATED!!!!!!!!!!!!!!!!!!!
Sign In or Register to comment.