Announcement

Collapse
No announcement yet.

Ultrasonic sensors and how to use "user?"

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ultrasonic sensors and how to use "user?"

    Ultrasonic:

    All I have been able to find on the NXT Ultrasonic sensors have been to use ports 4 and 5 on the Legacy Module and that they need to be put into some special 9v mode. How do I change that mode? Is it done with programming?


    User:

    If you look at this page and CTRL+F search for "user" you'll get the public byte user -what I'm referring to.
    I see a lot of stuff in the documentation like this, but I don't know enough about programming to know what it means and how to implement it into my code. I'm assuming it's a way to change the "ID 10 user: 1..." that appears on the driver station, to assign controller 1 and two specific names like "Gunner" or "Driver" that will appear next the inputs that show up when a program is ran. Am I correct? If not, is there a way to do what I described?

  • #2
    The user bytes seems to be something we don't need to touch that I know about for the Gamepad, (it should have a value at runtime).

    Once you get a reference to the Ultrasonic, use the "getUltrasonicLevel()" function to get the output (the statement should be something like "double distanceFromFoo = foo.getUltrasonicLevel()" I would recommend an unequal wieghted average that either takes care of timestamping the values or drops the oldest value if we get to a certain threshold.

    Comment


    • #3
      Not necessary, yes, but something I thought'd be cool to have.

      Is the only way to reference it from the code? The legacy module doesn't detect Ultrasonic sensors, at least from what I've seen.

      Comment

      Working...
      X