PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. Ping.cpp - Library for using Ping))) Sensors with Arduino - Version 2
  3. Copyright (c) 2009 Caleb Zulawski. All right reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. */
  16. #ifndef Ping_h
  17. #define Ping_h
  18. #include "Arduino.h"
  19. class Ping
  20. {
  21. public:
  22. Ping(int pin);
  23. Ping(int pin, double in, double cm);
  24. void fire();
  25. int microseconds();
  26. double inches();
  27. double centimeters();
  28. private:
  29. int _pin;
  30. double _in;
  31. double _cm;
  32. long _duration;
  33. };
  34. #endif