Giter Site home page Giter Site logo

ultrasonic1shot's Introduction

Ultrasonic1Shot

Easy way to use the "single shot" mode of the LEGO Ultrasonic Sensor, using skatefriday/Team25's Ultrasonic single shot code. The single shot mode is reported to produce more reliable readings than the default mode.

Add the name of your java package at the top of each file and incorporate these into your normal codebase. Don't forget to add "OpModeTestUltrasonic" to your FtcOpModeRegister file to try out the test OpMode.

The test OpMode is set up for 2 ultrasonic sensors on legacy module ports 4 and 5. You may need to change the name of the legacy module to match what you named it in your RC configuration file. If you're only using a single ultrasonic sensor on port 4 or 5, just comment out or delete the code for the other sensor.

See OpModeTestUltrasonic for a simple example of how to use the code.

  1. initialize the Ultrasonic thread(s) in init() (or before waitForStart() in a LinearOpMode).
  2. interrupt the Ultrasonic thread(s) in stop() (or at the end of the runOpMode() method in a LinearOpMode).
  3. call getUltrasonicLevel() in loop() as necessary (or in runOpMode() in a LinearOpMode).

Other methods are getUltrasonicLevelMin(), ...Median(), and ...Max() which return the min, median, and max of the previous 5 ultrasonic level readings. 5 is a static int BUFFER_SIZE that can be changed in the UltrasonicSensorThread code.

Thanks to skatefriday/Team25 for the Ultrasonic single shot code!

ultrasonic1shot's People

Contributors

cheer4ftc avatar

Stargazers

 avatar AdrielPatrick avatar

Watchers

James Cloos avatar  avatar AdrielPatrick avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.